mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-04 21:22:07 +00:00
Backport of #11568 to `core/1.43`. ## Changes Applies the e2e workflow filtering changes from #11568 to the `core/1.43` release branch: - **ci-tests-e2e.yaml**: Removed `paths-ignore` from `pull_request` trigger, added `changes` job using `dorny/paths-filter` to detect e2e-relevant file changes, added `needs: changes` and `should_run` conditions to `setup`, `merge-reports`, `comment-on-pr-start`, and `deploy-and-comment` jobs. - **ci-tests-e2e-forks.yaml**: Switched `download-artifact` from `actions/download-artifact@v7` to `dawidd6/action-download-artifact@v12`, added `if_no_artifact_found: warn`, added `hashFiles('reports/**') != ''` condition to `Handle Test Completion`. - **ci-tests-e2e-coverage.yaml**: Skipped — file does not exist on `core/1.43`. ## Conflict Resolution - Kept `core/1.43` branch's existing structure: container image `0.0.16`, cloud build steps, `cloud` browser matrix entry, `Get PR Number` step (not `resolve-pr-from-workflow-run`), `pnpm/action-setup@v4.4.0`. - Applied only the PR's intended behavioral changes on top. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-11592-backport-core-1-43-ci-filter-e2e-workflow-on-PRs-to-skip-unrelated-changes-34c6d73d36508158ac90c13b298132fb) by [Unito](https://www.unito.io) --------- Co-authored-by: Amp <amp@ampcode.com>
92 lines
3.7 KiB
YAML
92 lines
3.7 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]
|
|
|
|
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: Get PR Number
|
|
id: pr
|
|
uses: actions/github-script@v8
|
|
with:
|
|
script: |
|
|
const { data: prs } = await github.rest.pulls.list({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
state: 'open',
|
|
});
|
|
|
|
const pr = prs.find(p => p.head.sha === context.payload.workflow_run.head_sha);
|
|
|
|
if (!pr) {
|
|
console.log('No PR found for SHA:', context.payload.workflow_run.head_sha);
|
|
return null;
|
|
}
|
|
|
|
console.log(`Found PR #${pr.number} from fork: ${context.payload.workflow_run.head_repository.full_name}`);
|
|
return pr.number;
|
|
|
|
- name: Handle Test Start
|
|
if: steps.pr.outputs.result != 'null' && 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.result }}" \
|
|
"${{ github.event.workflow_run.head_branch }}" \
|
|
"starting"
|
|
|
|
- name: Download and Deploy Reports
|
|
if: steps.pr.outputs.result != 'null' && 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
|
|
if: steps.pr.outputs.result != 'null' && 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 }}
|
|
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.result }}" \
|
|
"${{ github.event.workflow_run.head_branch }}" \
|
|
"completed"
|