Skip to content

ci: label-gated on-demand Vercel previews - #830

Draft
jhoffner wants to merge 2 commits into
mainfrom
claude/vercel-on-demand-preview-labels-104h7x
Draft

jhoffner wants to merge 2 commits into
mainfrom
claude/vercel-on-demand-preview-labels-104h7x

Conversation

@jhoffner

@jhoffner jhoffner commented Jul 20, 2026 •

Copy link
Copy Markdown
Collaborator

What & why

Vercel currently rebuilds on every commit to every PR branch, which is noisy given how often we commit. We rarely need a PR preview, but when we do we want it — without paying the per-commit build tax. This replaces automatic git deploys with opt-in, label-gated previews.

How it works

  • Vercel git auto-deploys are turned off at the source via git.deploymentEnabled: false in each project's vercel.json (apps/kitchen-sink, apps/docs, packages/ui). We deliberately avoid the flaky Ignored Build Step mechanism, which produces stuck "waiting for deployment" / phantom-canceled checks.
  • A new Preview Deploy workflow (.github/workflows/preview-deploy.yml) triggers on labeled / synchronize and deploys only the labeled target(s), building locally in the runner and uploading prebuilt artifacts (vercel build + vercel deploy --prebuilt), so Vercel never runs its own build.
Label Deploys
preview/kitchen-sink apps/kitchen-sink (Next.js)
preview/docs apps/docs (Docusaurus)
preview/storybook packages/ui (Storybook)
  • The deployment link is documented as a sticky PR comment, one per target, updated in place on each redeploy.
  • While a label stays applied, new commits redeploy that target (synchronize). Remove the label to stop. This is documented and easy to switch to [labeled]-only if we'd rather deploy strictly on the labeled commit.

Setup required before this works (see docs/contributing/preview-deployments.md)

  • Secrets: VERCEL_TOKEN, VERCEL_ORG_ID, VERCEL_PROJECT_ID_KITCHEN_SINK, VERCEL_PROJECT_ID_DOCS, VERCEL_PROJECT_ID_STORYBOOK.
  • Create the three preview/* labels.
  • Trigger one deploy per project so Vercel registers the disabled git integration.
  • Remove any required Vercel deployment status check from branch protection.

Notes

  • Three separate Vercel projects (one per vercel.json) → per-project ID secrets.
  • Internal-only change → empty changeset per BP-022.

🤖 Generated with Claude Code

https://claude.ai/code/session_01YNm7FjNHvCmkfEyZAbwNoB


Generated by Claude Code


Note

Medium Risk
Changes how all PR previews are produced and requires secrets/branch-protection follow-up; misconfiguration could block merges or leave teams without previews until labels are applied.

Overview
Stops automatic Vercel builds on every PR push and replaces them with opt-in previews triggered by preview/* labels.

Each Vercel project (apps/kitchen-sink, apps/docs, packages/ui) now sets git.deploymentEnabled: false in vercel.json. A new Preview Deploy workflow runs on PR labeled / synchronize, maps labels to targets (preview/kitchen-sink, preview/docs, preview/storybook), builds on the runner with vercel build + vercel deploy --prebuilt, and posts or updates a sticky PR comment per target. Concurrency cancels in-flight deploys when newer commits land.

docs/contributing/preview-deployments.md documents usage, required GitHub secrets, label setup, and branch-protection notes. An internal changeset records the change.

Reviewed by Cursor Bugbot for commit 8a1910c. Configure here.

Replace Vercel's per-push git auto-deploys with opt-in, label-gated
previews. Disable Vercel's git integration via git.deploymentEnabled:false
in each project's vercel.json (kitchen-sink, docs, ui/storybook), and add a
Preview Deploy workflow that builds and deploys a target from the PR branch
when a preview/* label is applied, posting the deployment URL as a sticky
PR comment. Redeploys on new commits while the label is present.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YNm7FjNHvCmkfEyZAbwNoB
Preview deploys failed cryptically ("--token missing a value") when the
Vercel secrets aren't configured, and posted no comment, so labeled targets
had no findable link. Add a preflight that detects missing secrets and skip
the deploy steps, and always post a sticky per-target comment: the URL on
success, an actionable pointer (missing secrets / build failed) with a link
to the run otherwise. Each label remains an independent run/check/comment.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YNm7FjNHvCmkfEyZAbwNoB
@github-actions

github-actions Bot commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Preview — storybook (not configured)

Deploy skipped for bf3c154: missing repository secret(s): VERCEL_PROJECT_ID(for storybook).
Add them under Settings → Secrets and variables → Actions — see docs/contributing/preview-deployments.md.

View run

@github-actions

github-actions Bot commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

❌ Preview — kitchen-sink (build failed)

Deploy failed for bf3c154. View logs.

@github-actions

github-actions Bot commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Preview — docs (not configured)

Deploy skipped for bf3c154: missing repository secret(s): VERCEL_PROJECT_ID(for docs).
Add them under Settings → Secrets and variables → Actions — see docs/contributing/preview-deployments.md.

View run

@jhoffner

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-31T22:58:39.244808Z bf3c154 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bf3c154fce

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/docs/vercel.json
@@ -1,4 +1,7 @@
{
"git": {
"deploymentEnabled": false

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve production deployments when disabling automatic previews

After this merges to the production branch, production updates stop as well as PR previews. Vercel documents that this boolean disables automatic deployments for “all branches”, and the same setting is added to all three projects. I checked .github/workflows/preview-deploy.yml, ci.yml, release.yml, and snapshot-release.yml: the replacement only handles PR events and deploys preview artifacts, with no production deployment path. Keep the production branch enabled through a branch-specific configuration, or add a production deployment replacement before disabling the git integration globally.

Useful? React with 👍 / 👎.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants