mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-04 13:12:10 +00:00
## Summary Extract duplicated PR-number-resolution logic from `workflow_run`-triggered workflows into a shared composite action at `.github/actions/resolve-pr-from-workflow-run/`. ## Changes - **What**: New composite action that resolves PR number from `workflow_run` context using `pull_requests[0]` with `listPullRequestsAssociatedWithCommit` fallback. Updated 4 consumer workflows; removed dead artifact-stored PR metadata from 2 CI workflows. - **Files touched**: - `.github/actions/resolve-pr-from-workflow-run/action.yaml` (new) - `.github/workflows/pr-vercel-website-preview.yaml` (uses shared action) - `.github/workflows/pr-report.yaml` (uses shared action with `check-staleness: true`) - `.github/workflows/ci-tests-storybook-forks.yaml` (replaced `pulls.list` scan) - `.github/workflows/ci-tests-e2e-forks.yaml` (replaced `pulls.list` scan) - `.github/workflows/ci-size-data.yaml` (removed dead `number.txt`/`base.txt`/`head-sha.txt` writes) - `.github/workflows/ci-perf-report.yaml` (removed dead `perf-meta` artifact) ## Review Focus - The fork workflows previously used `pulls.list` (fetches all open PRs, linear scan by SHA). The shared action uses the more targeted `workflow_run.pull_requests[0]` + `listPullRequestsAssociatedWithCommit` fallback. - `coverage-slack-notify.yaml` was intentionally left unchanged — it parses merged commit messages on `main` pushes, which is a different use case. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-11336-refactor-extract-shared-resolve-pr-from-workflow-run-action-3456d73d365081e5b8f5ea29c020763e) by [Unito](https://www.unito.io) --------- Co-authored-by: bymyself <cbyrne@comfy.org> Co-authored-by: Amp <amp@ampcode.com>
78 lines
3.2 KiB
YAML
78 lines
3.2 KiB
YAML
# Description: Deploys test results from forked PRs (forks can't access 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 &&
|
|
github.event.workflow_run.head_repository.full_name != github.event.workflow_run.repository.full_name
|
|
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@v6
|
|
|
|
- name: Resolve PR from workflow_run context
|
|
id: pr
|
|
uses: ./.github/actions/resolve-pr-from-workflow-run
|
|
|
|
- name: Handle Test Start
|
|
if: steps.pr.outputs.skip != 'true' && github.event.action == 'requested'
|
|
env:
|
|
GITHUB_TOKEN: ${{ github.token }}
|
|
run: |
|
|
chmod +x scripts/cicd/pr-playwright-deploy-and-comment.sh
|
|
./scripts/cicd/pr-playwright-deploy-and-comment.sh \
|
|
"${{ steps.pr.outputs.number }}" \
|
|
"${{ github.event.workflow_run.head_branch }}" \
|
|
"starting"
|
|
|
|
- name: Download and Deploy Reports
|
|
if: steps.pr.outputs.skip != 'true' && github.event.action == 'completed'
|
|
uses: actions/download-artifact@v7
|
|
with:
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
run-id: ${{ github.event.workflow_run.id }}
|
|
pattern: playwright-report-*
|
|
path: reports
|
|
|
|
- name: Handle Test Completion
|
|
if: steps.pr.outputs.skip != 'true' && github.event.action == 'completed'
|
|
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 }}
|
|
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 }}" \
|
|
"${{ github.event.workflow_run.head_branch }}" \
|
|
"completed"
|