CI: Tests E2E (Deploy for Forks) #69036
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Description: Deploys test results for PRs without direct access to deployment secrets | |
| name: 'CI: Tests E2E (Deploy for Forks)' | |
| on: | |
| workflow_run: | |
| workflows: ['CI: Tests E2E'] | |
| types: [requested, completed] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.workflow_run.head_repository.full_name }}-${{ github.event.workflow_run.head_branch }} | |
| cancel-in-progress: true | |
| jobs: | |
| deploy-and-comment-forked-pr: | |
| runs-on: ubuntu-latest | |
| if: | | |
| github.repository == 'Comfy-Org/ComfyUI_frontend' && | |
| github.event.workflow_run.event == 'pull_request' && | |
| github.event.workflow_run.head_repository != null && | |
| github.event.workflow_run.repository != null | |
| permissions: | |
| pull-requests: write | |
| actions: read | |
| steps: | |
| - name: Log workflow trigger info | |
| run: | | |
| echo "Repository: ${{ github.repository }}" | |
| echo "Event: ${{ github.event.workflow_run.event }}" | |
| echo "Head repo: ${{ github.event.workflow_run.head_repository.full_name || 'null' }}" | |
| echo "Base repo: ${{ github.event.workflow_run.repository.full_name || 'null' }}" | |
| echo "Is forked: ${{ github.event.workflow_run.head_repository.full_name != github.event.workflow_run.repository.full_name }}" | |
| - name: Checkout repository | |
| uses: actions/checkout@v7 | |
| - name: Resolve PR from workflow_run context | |
| id: pr | |
| uses: ./.github/actions/resolve-pr-from-workflow-run | |
| - name: Determine deployment route | |
| id: route | |
| if: steps.pr.outputs.skip != 'true' | |
| env: | |
| IS_FORKED: ${{ github.event.workflow_run.head_repository.full_name != github.event.workflow_run.repository.full_name }} | |
| PR_AUTHOR: ${{ steps.pr.outputs.author }} | |
| run: | | |
| if [[ "$IS_FORKED" == "true" || "$PR_AUTHOR" == "dependabot[bot]" ]]; then | |
| echo "handle=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "handle=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| echo "PR author: $PR_AUTHOR" | |
| - name: Handle Test Start — upsert playwright starting section | |
| if: steps.route.outputs.handle == 'true' && github.event.action == 'requested' | |
| uses: ./.github/actions/upsert-comment-section | |
| with: | |
| pr-number: ${{ steps.pr.outputs.number }} | |
| section-name: playwright | |
| section-content: '## 🎭 Playwright: ⏳ Running...' | |
| token: ${{ github.token }} | |
| - name: Download and Deploy Reports | |
| if: steps.route.outputs.handle == 'true' && github.event.action == 'completed' | |
| uses: dawidd6/action-download-artifact@0bd50d53a6d7fb5cb921e607957e9cc12b4ce392 # v12 | |
| with: | |
| run_id: ${{ github.event.workflow_run.id }} | |
| name: playwright-report-.* | |
| name_is_regexp: true | |
| path: reports | |
| if_no_artifact_found: warn | |
| - name: Handle Test Completion — deploy and generate section | |
| if: steps.route.outputs.handle == 'true' && github.event.action == 'completed' && hashFiles('reports/**') != '' | |
| env: | |
| CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| GITHUB_TOKEN: ${{ github.token }} | |
| GITHUB_SHA: ${{ github.event.workflow_run.head_sha }} | |
| SUMMARY_FILE: playwright-section.md | |
| BRANCH_NAME: ${{ github.event.workflow_run.head_branch }} | |
| run: | | |
| # Rename merged report if exists | |
| [ -d "reports/playwright-report-chromium-merged" ] && \ | |
| mv reports/playwright-report-chromium-merged reports/playwright-report-chromium | |
| chmod +x scripts/cicd/pr-playwright-deploy-and-comment.sh | |
| ./scripts/cicd/pr-playwright-deploy-and-comment.sh \ | |
| "${{ steps.pr.outputs.number }}" \ | |
| "$BRANCH_NAME" \ | |
| "completed" | |
| - name: Read and upsert playwright section | |
| if: steps.route.outputs.handle == 'true' && github.event.action == 'completed' | |
| uses: ./.github/actions/read-and-upsert-comment-section | |
| with: | |
| pr-number: ${{ steps.pr.outputs.number }} | |
| section-name: playwright | |
| section-file: playwright-section.md | |
| token: ${{ github.token }} |