mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-04 21:22:07 +00:00
## Summary Vercel's auto-deploy triggers on every PR because files outside workspace packages (e.g. `browser_tests/`, `src/`) are treated as global changes by the monorepo skip logic. ## Changes - **What**: Replace Vercel's GitHub integration with a GitHub Action (`ci-vercel-website-preview.yaml`) that uses `paths:` filtering to only deploy when `apps/website/`, `packages/design-system/`, or `packages/tailwind-utils/` change. Add `vercel.json` with `github.enabled: false` to disable Vercel's automatic GitHub integration. ## Setup required after merge Three GitHub repo secrets are needed. All secrets are scoped per-project using the `VERCEL_WEBSITE_*` prefix. Future Vercel projects would follow the same convention (e.g. `VERCEL_DOCS_*`). ### Step 1: Create a Vercel API Token 1. Go to [vercel.com/account/tokens](https://vercel.com/account/tokens) 2. Click **Create Token** 3. Fill in the form: - **Token Name**: `github-actions-website` - **Scope**: Select the **Comfy-Org** team (not "Full Account" — scope it to the team that owns the project) - **Expiration**: Choose **No Expiration** (or set a long expiration like 1 year — if it expires the workflow will silently fail) 4. Click **Create** 5. **Copy the token immediately** — it is only shown once ### Step 2: Get Vercel Org ID and Project ID 1. Go to [vercel.com/comfyui/website-frontend/settings](https://vercel.com/comfyui/website-frontend/settings) 2. Scroll down to the **Project ID** field — copy this value 3. Go to [vercel.com/teams/comfyui/settings](https://vercel.com/teams/comfyui/settings) (Team Settings → General) 4. Find the **Vercel ID** field (also called Team ID / Org ID) — copy this value ### Step 3: Add secrets to GitHub 1. Go to [github.com/Comfy-Org/ComfyUI_frontend/settings/secrets/actions](https://github.com/Comfy-Org/ComfyUI_frontend/settings/secrets/actions) 2. Click **New repository secret** and add each of the three secrets: | Secret name | Value | |---|---| | `VERCEL_WEBSITE_TOKEN` | The token from Step 1 | | `VERCEL_WEBSITE_ORG_ID` | The team/org ID from Step 2 | | `VERCEL_WEBSITE_PROJECT_ID` | The project ID from Step 2 | > **Note:** The `vercel.json` added by this PR (`github.enabled: false`) automatically disables Vercel's built-in auto-deploy — no dashboard changes needed. ## Review Focus - Verify the `paths:` filter covers all dependencies of `apps/website` - Confirm the PR comment logic is sound (creates once, updates on subsequent pushes) --------- 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 }}
|