🧪 Simplify temporary testing to directly target PR #3574

This commit is contained in:
Daniel Dudzic 2025-08-01 12:16:49 +02:00
parent a1902902a8
commit fd87f93673
No known key found for this signature in database
GPG key ID: 31B40D33E3465483

View file

@ -12,6 +12,14 @@ on:
workflows: ["PR Playground Demo"]
types:
- completed
push:
branches:
- 'PCP-5039-*'
paths:
- 'src/**'
- 'assets/**'
- 'package.json'
- 'composer.json'
# Cancels all previous workflow runs for pull requests that have not completed.
concurrency:
@ -24,8 +32,11 @@ permissions: {}
jobs:
create_archive:
runs-on: ubuntu-latest
# Only run for the main repository, not forks
if: github.repository == 'woocommerce/woocommerce-paypal-payments' && github.event_name == 'pull_request'
# 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' ||
(github.event_name == 'push' && startsWith(github.ref_name, 'PCP-5039-')))
outputs:
artifact_name: ${{ steps.version.outputs.artifact_name }}
plugin_version: ${{ steps.version.outputs.plugin_version }}
@ -37,7 +48,7 @@ jobs:
run: |
BASE_VERSION=$(sed -nE '/Version:/s/.* ([0-9.]+).*/\1/p' woocommerce-paypal-payments.php)
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}"
echo "plugin_version=$PR_VERSION" >> $GITHUB_OUTPUT
echo "artifact_name=$ARTIFACT_NAME" >> $GITHUB_OUTPUT
@ -53,11 +64,10 @@ jobs:
ARCHIVE_NAME: ${{ steps.version.outputs.artifact_name }}
COMPILE_ASSETS_ARGS: "-vv --env=root"
# Store PR number for the workflow_run job
- name: Save PR number
- name: Save PR details
run: |
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.artifact_name }}" > ./pr/ARTIFACT
@ -145,3 +155,58 @@ jobs:
};
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
# =============================================================================