mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-08-30 05:00:51 +08:00
🧪 Simplify temporary testing to directly target PR #3574
This commit is contained in:
parent
a1902902a8
commit
fd87f93673
1 changed files with 71 additions and 6 deletions
77
.github/workflows/pr-playground-demo.yml
vendored
77
.github/workflows/pr-playground-demo.yml
vendored
|
@ -12,6 +12,14 @@ on:
|
||||||
workflows: ["PR Playground Demo"]
|
workflows: ["PR Playground Demo"]
|
||||||
types:
|
types:
|
||||||
- completed
|
- completed
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- 'PCP-5039-*'
|
||||||
|
paths:
|
||||||
|
- 'src/**'
|
||||||
|
- 'assets/**'
|
||||||
|
- 'package.json'
|
||||||
|
- 'composer.json'
|
||||||
|
|
||||||
# Cancels all previous workflow runs for pull requests that have not completed.
|
# Cancels all previous workflow runs for pull requests that have not completed.
|
||||||
concurrency:
|
concurrency:
|
||||||
|
@ -24,8 +32,11 @@ permissions: {}
|
||||||
jobs:
|
jobs:
|
||||||
create_archive:
|
create_archive:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
# Only run for the main repository, not forks
|
# Only run for the main repository, not forks, and allow push events on PCP-5039 branches
|
||||||
if: github.repository == 'woocommerce/woocommerce-paypal-payments' && github.event_name == 'pull_request'
|
if: >
|
||||||
|
github.repository == 'woocommerce/woocommerce-paypal-payments' &&
|
||||||
|
(github.event_name == 'pull_request' ||
|
||||||
|
(github.event_name == 'push' && startsWith(github.ref_name, 'PCP-5039-')))
|
||||||
outputs:
|
outputs:
|
||||||
artifact_name: ${{ steps.version.outputs.artifact_name }}
|
artifact_name: ${{ steps.version.outputs.artifact_name }}
|
||||||
plugin_version: ${{ steps.version.outputs.plugin_version }}
|
plugin_version: ${{ steps.version.outputs.plugin_version }}
|
||||||
|
@ -37,7 +48,7 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
BASE_VERSION=$(sed -nE '/Version:/s/.* ([0-9.]+).*/\1/p' woocommerce-paypal-payments.php)
|
BASE_VERSION=$(sed -nE '/Version:/s/.* ([0-9.]+).*/\1/p' woocommerce-paypal-payments.php)
|
||||||
VERSUFFIX="${GITHUB_RUN_ID}-g$(git rev-parse --short HEAD)"
|
VERSUFFIX="${GITHUB_RUN_ID}-g$(git rev-parse --short HEAD)"
|
||||||
PR_VERSION="${BASE_VERSION}-pr${{ github.event.pull_request.number }}-${VERSUFFIX}"
|
PR_VERSION="${BASE_VERSION}-pr${{ github.event.pull_request.number || '0' }}-${VERSUFFIX}"
|
||||||
ARTIFACT_NAME="woocommerce-paypal-payments-${PR_VERSION}"
|
ARTIFACT_NAME="woocommerce-paypal-payments-${PR_VERSION}"
|
||||||
echo "plugin_version=$PR_VERSION" >> $GITHUB_OUTPUT
|
echo "plugin_version=$PR_VERSION" >> $GITHUB_OUTPUT
|
||||||
echo "artifact_name=$ARTIFACT_NAME" >> $GITHUB_OUTPUT
|
echo "artifact_name=$ARTIFACT_NAME" >> $GITHUB_OUTPUT
|
||||||
|
@ -53,11 +64,10 @@ jobs:
|
||||||
ARCHIVE_NAME: ${{ steps.version.outputs.artifact_name }}
|
ARCHIVE_NAME: ${{ steps.version.outputs.artifact_name }}
|
||||||
COMPILE_ASSETS_ARGS: "-vv --env=root"
|
COMPILE_ASSETS_ARGS: "-vv --env=root"
|
||||||
|
|
||||||
# Store PR number for the workflow_run job
|
- name: Save PR details
|
||||||
- name: Save PR number
|
|
||||||
run: |
|
run: |
|
||||||
mkdir -p ./pr
|
mkdir -p ./pr
|
||||||
echo "${{ github.event.number }}" > ./pr/NR
|
echo "${{ github.event.pull_request.number || '0' }}" > ./pr/NR
|
||||||
echo "${{ steps.version.outputs.plugin_version }}" > ./pr/VERSION
|
echo "${{ steps.version.outputs.plugin_version }}" > ./pr/VERSION
|
||||||
echo "${{ steps.version.outputs.artifact_name }}" > ./pr/ARTIFACT
|
echo "${{ steps.version.outputs.artifact_name }}" > ./pr/ARTIFACT
|
||||||
|
|
||||||
|
@ -145,3 +155,58 @@ jobs:
|
||||||
};
|
};
|
||||||
|
|
||||||
await script.run({ github, context: mockContext, core });
|
await script.run({ github, context: mockContext, core });
|
||||||
|
|
||||||
|
# =============================================================================
|
||||||
|
# TEMPORARY TESTING JOB - REMOVE AFTER TESTING COMPLETE
|
||||||
|
# =============================================================================
|
||||||
|
|
||||||
|
temporary_comment_testing:
|
||||||
|
name: "[TEMP] Test Comment on PR #3574"
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: create_archive
|
||||||
|
permissions:
|
||||||
|
issues: write
|
||||||
|
pull-requests: write
|
||||||
|
# TEMPORARY: Only for testing workflow development on PCP-5039 branches
|
||||||
|
if: >
|
||||||
|
github.repository == 'woocommerce/woocommerce-paypal-payments' &&
|
||||||
|
github.event_name == 'push' &&
|
||||||
|
startsWith(github.ref_name, 'PCP-5039-') &&
|
||||||
|
needs.create_archive.result == 'success'
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: "[TEMP] Checkout for testing"
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: "[TEMP] Test comment on PR #3574"
|
||||||
|
uses: actions/github-script@v7
|
||||||
|
env:
|
||||||
|
PLUGIN_VERSION: ${{ needs.create_archive.outputs.plugin_version }}
|
||||||
|
ARTIFACT_NAME: ${{ needs.create_archive.outputs.artifact_name }}
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
console.log("🧪 TEMPORARY TESTING: Testing comment on PR #3574");
|
||||||
|
|
||||||
|
const script = require('./.github/scripts/playground-comment.js');
|
||||||
|
|
||||||
|
// Direct context for PR #3574
|
||||||
|
const mockContext = {
|
||||||
|
...context,
|
||||||
|
issue: { number: 3574 },
|
||||||
|
runId: context.runId,
|
||||||
|
payload: {
|
||||||
|
pull_request: {
|
||||||
|
head: {
|
||||||
|
sha: '${{ github.sha }}'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
console.log("🧪 TEMPORARY TESTING: Posting comment to PR #3574");
|
||||||
|
await script.run({ github, context: mockContext, core });
|
||||||
|
console.log("🧪 TEMPORARY TESTING: Comment posted successfully");
|
||||||
|
|
||||||
|
# =============================================================================
|
||||||
|
# END TEMPORARY TESTING SECTION
|
||||||
|
# =============================================================================
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue