diff --git a/.github/workflows/ci-tests-e2e.yaml b/.github/workflows/ci-tests-e2e.yaml index c1e0af411e1..36dc863b92c 100644 --- a/.github/workflows/ci-tests-e2e.yaml +++ b/.github/workflows/ci-tests-e2e.yaml @@ -6,10 +6,14 @@ on: branches: [main, master, core/*, desktop/*] pull_request: branches-ignore: - [wip/*, draft/*, temp/*, vue-nodes-migration, sno-playwright-*] + [wip/*, draft/*, temp/*, vue-nodes-migration, version-bump-*] + # Run after i18n workflow completes for version-bump PRs + workflow_run: + workflows: ['i18n: Update Core'] + types: [completed] concurrency: - group: ${{ github.workflow }}-${{ github.ref }} + group: ${{ github.workflow }}-${{ github.event.workflow_run.head_branch || github.ref }} cancel-in-progress: true jobs: @@ -18,6 +22,8 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v5 + with: + ref: ${{ github.event.workflow_run.head_branch || github.ref }} - name: Setup frontend uses: ./.github/actions/setup-frontend with: @@ -52,6 +58,8 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v5 + with: + ref: ${{ github.event.workflow_run.head_branch || github.ref }} - name: Download built frontend uses: actions/download-artifact@v4 with: @@ -99,6 +107,8 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v5 + with: + ref: ${{ github.event.workflow_run.head_branch || github.ref }} - name: Download built frontend uses: actions/download-artifact@v4 with: @@ -143,6 +153,8 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v5 + with: + ref: ${{ github.event.workflow_run.head_branch || github.ref }} - name: Install pnpm uses: pnpm/action-setup@v4 @@ -175,15 +187,43 @@ jobs: # when using pull_request event, we have permission to comment directly # if its a forked repo, we need to use workflow_run event in a separate workflow (pr-playwright-deploy.yaml) + # Get PR info once for reuse by comment jobs + get-pr-info: + runs-on: ubuntu-latest + if: | + (github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false) || + (github.event_name == 'workflow_run') + outputs: + pr_number: ${{ steps.get-pr.outputs.number }} + branch: ${{ steps.get-pr.outputs.branch }} + steps: + - name: Get PR number + id: get-pr + env: + GH_TOKEN: ${{ github.token }} + PR_TARGET_REPO: ${{ github.repository }} + PR_NUMBER: ${{ github.event.pull_request.number }} + PR_BRANCH: ${{ github.head_ref || github.event.workflow_run.head_branch }} + run: | + echo "branch=${PR_BRANCH}" >> $GITHUB_OUTPUT + if [ -n "$PR_NUMBER" ]; then + echo "number=${PR_NUMBER}" >> $GITHUB_OUTPUT + else + gh pr view --repo "${PR_TARGET_REPO}" "${PR_BRANCH}" \ + --json 'number' --jq '"number=\(.number)"' >> $GITHUB_OUTPUT + fi + # Post starting comment for non-forked PRs comment-on-pr-start: + needs: get-pr-info runs-on: ubuntu-latest - if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false permissions: pull-requests: write steps: - name: Checkout repository uses: actions/checkout@v5 + with: + ref: ${{ github.event.workflow_run.head_branch || github.ref }} - name: Get start time id: start-time @@ -192,25 +232,30 @@ jobs: - name: Post starting comment env: GITHUB_TOKEN: ${{ github.token }} + PR_NUMBER: ${{ needs.get-pr-info.outputs.pr_number }} + BRANCH: ${{ needs.get-pr-info.outputs.branch }} + START_TIME: ${{ steps.start-time.outputs.time }} run: | chmod +x scripts/cicd/pr-playwright-deploy-and-comment.sh ./scripts/cicd/pr-playwright-deploy-and-comment.sh \ - "${{ github.event.pull_request.number }}" \ - "${{ github.head_ref }}" \ + "$PR_NUMBER" \ + "$BRANCH" \ "starting" \ - "${{ steps.start-time.outputs.time }}" + "$START_TIME" # Deploy and comment for non-forked PRs only deploy-and-comment: - needs: [playwright-tests, merge-reports] + needs: [playwright-tests, merge-reports, get-pr-info] runs-on: ubuntu-latest - if: always() && github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false + if: always() permissions: pull-requests: write contents: read steps: - name: Checkout repository uses: actions/checkout@v5 + with: + ref: ${{ github.event.workflow_run.head_branch || github.ref }} - name: Download all playwright reports uses: actions/download-artifact@v4 @@ -223,10 +268,12 @@ jobs: CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} GITHUB_TOKEN: ${{ github.token }} - GITHUB_SHA: ${{ github.event.pull_request.head.sha }} + GITHUB_SHA: ${{ github.event.pull_request.head.sha || github.event.workflow_run.head_sha }} + PR_NUMBER: ${{ needs.get-pr-info.outputs.pr_number }} + BRANCH: ${{ needs.get-pr-info.outputs.branch }} run: | bash ./scripts/cicd/pr-playwright-deploy-and-comment.sh \ - "${{ github.event.pull_request.number }}" \ - "${{ github.head_ref }}" \ + "$PR_NUMBER" \ + "$BRANCH" \ "completed" #### END Deployment and commenting (non-forked PRs only)