Skip to content

ci/vercel: Skip preview builds for PRs that only touch non-site files - #1901

Open
marcleblanc2 wants to merge 2 commits into
mainfrom
ci/vercel-ignore-non-site-changes
Open

ci/vercel: Skip preview builds for PRs that only touch non-site files#1901
marcleblanc2 wants to merge 2 commits into
mainfrom
ci/vercel-ignore-non-site-changes

Conversation

@marcleblanc2

@marcleblanc2 marcleblanc2 commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Why

PRs that only change CI workflows, agent config, or repo docs (.github/, AGENTS.md, cspell lists, ...) currently trigger a full Vercel build and preview deploy that has nothing to preview.

What

Adds vercel.json with an ignoreCommand. Vercel runs it before each build: exit 0 skips, exit 1 builds.

The command diffs HEAD^..HEAD with these paths excluded: .github, .agents, .amp, .vscode, AGENTS.md, README.md, .gitignore, cspell*, dev/TODO.md. If nothing else changed, the build is skipped. Everything the site builds from (docs/, src/, public/, dev/, root configs, lockfile) still builds. dev/ stays build-relevant because next.config.js runs the dev/check-*.mjs scripts during next build.

Verification

  • Ran the exact command against the last 8 commits on main: all touched site files and all correctly returned BUILD (including c89ef41, which was mostly .github/cspell/README but also touched src/data/redirects.ts).
  • Synthetic commit touching only .gitignore, cspell-allow-list.txt, .github/x/y.yml: exit 0 (SKIP).
  • Synthetic commit touching docs/: exit 1 (BUILD).

Caveats

  • Vercel clones --depth=10 and this compares only the last commit. A push of several commits where only the last is non-site-only would be skipped. Squash merges to main are one commit, so production is unaffected.
  • A skipped build shows on the PR as a canceled Vercel deployment, not a green check. The main ruleset has no required status checks, so this does not block merging.
  • This PR itself only adds vercel.json, which is not in the exclude list, so Vercel should still build it.

@vercel

vercel Bot commented Sep 11, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
sourcegraph-docs Ready Ready Preview Sep 11, 2026 9:46am UTC

Request Review

Adds a vercel.json ignoreCommand so Vercel skips the build when every
changed file is outside what the site builds from: .github, .agents,
.amp, .vscode, AGENTS.md, README.md, .gitignore, cspell*. Anything else
(docs, src, public, dev, root configs, lockfile) still builds.

Amp-Thread-ID: https://ampcode.com/threads/T-01a08e2d-682f-75dd-a050-cb9bf8888dac
Co-authored-by: Amp <amp@ampcode.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants