Repository navigation
internal(ci): Build the docs site only when its inputs change - #4141
Conversation
Vercel preview builds used git diff HEAD^ HEAD. Merging master into a package or CI pull request makes that the incoming master tree, so site commits already on master started a full preview build. Previews also ignored docs/core, docs/rest, and docs/graphql, which are the published pages. The ignore script builds for website changes (not the changelog or unit tests) and those doc trees. Preview branches compare the branch's own changes, so an upstream merge no longer counts. GitHub Actions site workflows use the same paths. Co-authored-by: Nathaniel Tucker <me@ntucker.me>
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Replace the per-file shell matcher with git pathspec excludes, collapse the duplicated test helpers into one `expect`, and add test cases for docs/graphql and non-test files under __tests__. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BamoUG3kFNUhtM7qYaGBgk
The HEAD^ fallback only checked the tip commit, so a site edit earlier on the branch could skip its first preview when shallow history hid the merge-base with master. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BamoUG3kFNUhtM7qYaGBgk
A merge commit is only treated as "merging master" when its second parent is on master, so merging a stacked branch with site changes still builds. Production no longer falls back to HEAD^, which could miss a site change earlier in a multi-commit push; it deepens the shallow clone to reach the last deploy and builds when there is none. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BamoUG3kFNUhtM7qYaGBgk
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 1948ec1. Configure here.
Merging master into a PR now always diffs against the merged master commit, so a site conflict resolution in the merge rebuilds the preview. When the merge-base with master is outside Vercel's shallow clone, the script deepens the branch and master instead of building every push of a long package-only PR. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BamoUG3kFNUhtM7qYaGBgk
Group merge_base with the other helpers and condense the cursor rule's diff-base guidance into one bullet. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BamoUG3kFNUhtM7qYaGBgk
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BamoUG3kFNUhtM7qYaGBgk

Requested by Nathaniel · project thread
Motivation
The Vercel Pro credit email ($15 of $20, resets October 14, 2026) lines up with preview builds, not with CircleCI. The Git integration builds the
docs-siteproject on every push.website/vercel.jsontried to skip unrelated commits withgit diff HEAD^ HEAD, and that check is wrong in both directions:masterinto a package or CI pull request makesHEAD^the incoming master tree. A site commit already on master starts a full preview build of a PR that did not touch the site. That is what burned the credit (for example fix(vue): Type useFetch() return as a read-only Ref #4114 completed a preview after a merge, with nowebsite/files of its own).website/. Published docs (docs/core,docs/rest,docs/graphql) did not get a preview, and a multi-commit PR was judged by its last commit only, so an earlier site edit could be skipped (docs: Vue versions of remaining docs pages #4113).CircleCI #4112 skips unit tests on docs-only diffs. It does not start or stop Vercel. GitHub Actions
site-previewalready path-filters, and itsvercel deployis commented out, so the preview URL comes from the Git integration.git.deploymentEnabled: falsewas removed in #3778 because the project dashboard overrode it.Solution
website/scripts/vercel-ignore.shis the Ignored Build Step. Exit 0 skips, exit 1 builds. It builds only when it can see a change to the published site (onegit diffover aSITE_PATHSpathspec list), and it builds whenever it cannot compute that diff.master, or from the merge-base withmaster. Merging another branch (stacked PRs) counts that branch's site changes. With no base at all, it builds.master,rest-hooks-site, orVERCEL_ENV=production) compares against the last successful deploy, deepening Vercel's shallow clone to reach it, and builds when there is none. It never judges a push byHEAD^alone.site-preview.ymlandsite-release.ymluse the same doc trees instead ofdocs/**. The preview workflow runs the script's fixture tests (website/scripts/vercel-ignore.test.sh).What still starts a website build
website/**, exceptwebsite/CHANGELOG.md,website/**/__tests__/**, andwebsite/**/*.test.*docs/core/**,docs/rest/**,docs/graphql/**website/**path. The workflow filter is coarser than the Vercel script.What no longer starts one
packages/**,examples/**, changesets, root markdown, CI-only pathsdocs/outside the three doc trees (e.g.docs/ROADMAP.md)website/CHANGELOG.mdand website unit tests (Vercel only)gh-pages*branchesmasterinto a pull request that does not itself change the paths aboveOpen questions
Vercel still creates a deployment for every push long enough to run the ignore script, then cancels it. Stopping them entirely means disconnecting the Git integration in the Vercel project settings.
🤖 Generated with Claude Code
https://claude.ai/code/session_01BamoUG3kFNUhtM7qYaGBgk
Note
Low Risk
CI and Vercel deploy gating only; no runtime library behavior, with fail-open when git comparisons cannot run.
Overview
Replaces Vercel’s
HEAD^vsHEADignore step withwebsite/scripts/vercel-ignore.sh, so preview builds stop firing when mergingmasterinto unrelated PRs and so published doc trees (docs/core,docs/rest,docs/graphql) count toward site changes. The script diffs a sharedSITE_PATHSlist (website minus changelog/tests, plus those doc trees), fails open when history is missing, and uses branch-specific bases: last deploy on production, merge-base / last preview / master-merge parent on previews, with shallowgit fetchwhen needed.site-preview.ymlandsite-release.ymlpath filters now match that list instead of all ofdocs/**, and the preview workflow runsvercel-ignore.test.shin CI..cursor/rules/ci-config.mdcdocuments keeping those paths in sync.Reviewed by Cursor Bugbot for commit 56fec30. Bugbot is set up for automated code reviews on this repo. Configure here.