From fd87f936732f81a7ea541da251fb7c878316db61 Mon Sep 17 00:00:00 2001 From: Daniel Dudzic Date: Fri, 1 Aug 2025 12:16:49 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=AA=20Simplify=20temporary=20testing?= =?UTF-8?q?=20to=20directly=20target=20PR=20#3574?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/pr-playground-demo.yml | 77 ++++++++++++++++++++++-- 1 file changed, 71 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pr-playground-demo.yml b/.github/workflows/pr-playground-demo.yml index e5722a9c2..6d24bebd3 100644 --- a/.github/workflows/pr-playground-demo.yml +++ b/.github/workflows/pr-playground-demo.yml @@ -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 + # =============================================================================