mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-05 05:32:02 +00:00
Backport of #11289 to `core/1.43` Automatically created by backport workflow. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-11483-backport-core-1-43-fix-deploy-website-previews-via-GitHub-Actions-instead-of-Vercel-a-3486d73d36508164a683c20663d017f3) by [Unito](https://www.unito.io) Co-authored-by: Christian Byrne <cbyrne@comfy.org> Co-authored-by: Alexander Brown <drjkl@comfy.org> Co-authored-by: DrJKL <DrJKL0424@gmail.com> Co-authored-by: Amp <amp@ampcode.com>
75 lines
2.3 KiB
YAML
75 lines
2.3 KiB
YAML
---
|
|
name: 'PR: Vercel Website Preview'
|
|
|
|
on:
|
|
workflow_run:
|
|
workflows: ['CI: Vercel Website Preview']
|
|
types:
|
|
- completed
|
|
|
|
permissions:
|
|
contents: read
|
|
pull-requests: write
|
|
actions: read
|
|
|
|
jobs:
|
|
comment:
|
|
runs-on: ubuntu-latest
|
|
if: >
|
|
github.repository == 'Comfy-Org/ComfyUI_frontend' &&
|
|
github.event.workflow_run.event == 'pull_request' &&
|
|
github.event.workflow_run.conclusion == 'success'
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
|
|
- name: Download preview metadata
|
|
uses: dawidd6/action-download-artifact@0bd50d53a6d7fb5cb921e607957e9cc12b4ce392 # v12
|
|
with:
|
|
name: vercel-preview
|
|
run_id: ${{ github.event.workflow_run.id }}
|
|
path: temp/vercel-preview
|
|
|
|
- name: Resolve PR number from workflow_run context
|
|
id: pr-meta
|
|
uses: actions/github-script@v8
|
|
with:
|
|
script: |
|
|
let pr = context.payload.workflow_run.pull_requests?.[0];
|
|
if (!pr) {
|
|
const { data: prs } = await github.rest.repos.listPullRequestsAssociatedWithCommit({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
commit_sha: context.payload.workflow_run.head_sha,
|
|
});
|
|
pr = prs.find(p => p.state === 'open');
|
|
}
|
|
|
|
if (!pr) {
|
|
core.info('No open PR found for this workflow run — skipping.');
|
|
core.setOutput('skip', 'true');
|
|
return;
|
|
}
|
|
|
|
core.setOutput('skip', 'false');
|
|
core.setOutput('number', String(pr.number));
|
|
|
|
- name: Read preview URL
|
|
if: steps.pr-meta.outputs.skip != 'true'
|
|
id: meta
|
|
run: |
|
|
echo "url=$(cat temp/vercel-preview/url.txt)" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Write report
|
|
if: steps.pr-meta.outputs.skip != 'true'
|
|
run: |
|
|
echo "**Website Preview:** ${{ steps.meta.outputs.url }}" > preview-report.md
|
|
|
|
- name: Post PR comment
|
|
if: steps.pr-meta.outputs.skip != 'true'
|
|
uses: ./.github/actions/post-pr-report-comment
|
|
with:
|
|
pr-number: ${{ steps.pr-meta.outputs.number }}
|
|
report-file: ./preview-report.md
|
|
comment-marker: '<!-- VERCEL_WEBSITE_PREVIEW -->'
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|