Skip to content

internal(ci): Build the docs site only when its inputs change - #4141

Merged
ntucker merged 9 commits into
masterfrom
cursor/limit-website-builds-9a5a
Oct 4, 2026
Merged

ntucker merged 9 commits into
masterfrom
cursor/limit-website-builds-9a5a

Conversation

@ntucker

@ntucker ntucker commented Oct 4, 2026 •

Copy link
Copy Markdown
Collaborator

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-site project on every push. website/vercel.json tried to skip unrelated commits with git diff HEAD^ HEAD, and that check is wrong in both directions:

  • Merging master into a package or CI pull request makes HEAD^ 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 no website/ files of its own).
  • On preview branches the old command only watched 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-preview already path-filters, and its vercel deploy is commented out, so the preview URL comes from the Git integration. git.deploymentEnabled: false was removed in #3778 because the project dashboard overrode it.

Solution

website/scripts/vercel-ignore.sh is the Ignored Build Step. Exit 0 skips, exit 1 builds. It builds only when it can see a change to the published site (one git diff over a SITE_PATHS pathspec list), and it builds whenever it cannot compute that diff.

  • Previews compare the branch's own changes: since the last successful preview, against the merged master commit when the tip merges master, or from the merge-base with master. Merging another branch (stacked PRs) counts that branch's site changes. With no base at all, it builds.
  • Production (master, rest-hooks-site, or VERCEL_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 by HEAD^ alone.

site-preview.yml and site-release.yml use the same doc trees instead of docs/**. The preview workflow runs the script's fixture tests (website/scripts/vercel-ignore.test.sh).

What still starts a website build

  • website/**, except website/CHANGELOG.md, website/**/__tests__/**, and website/**/*.test.*
  • docs/core/**, docs/rest/**, docs/graphql/**
  • On GitHub Actions, any website/** path. The workflow filter is coarser than the Vercel script.

What no longer starts one

  • packages/**, examples/**, changesets, root markdown, CI-only paths
  • docs/ outside the three doc trees (e.g. docs/ROADMAP.md)
  • website/CHANGELOG.md and website unit tests (Vercel only)
  • gh-pages* branches
  • Merging master into a pull request that does not itself change the paths above

Open 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^ vs HEAD ignore step with website/scripts/vercel-ignore.sh, so preview builds stop firing when merging master into unrelated PRs and so published doc trees (docs/core, docs/rest, docs/graphql) count toward site changes. The script diffs a shared SITE_PATHS list (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 shallow git fetch when needed.

site-preview.yml and site-release.yml path filters now match that list instead of all of docs/**, and the preview workflow runs vercel-ignore.test.sh in CI. .cursor/rules/ci-config.mdc documents 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.

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>
@changeset-bot

changeset-bot Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 56fec30

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel

vercel Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
docs-site Ready Ready Preview Oct 4, 2026 2:08pm UTC

Request Review

@ntucker
ntucker marked this pull request as ready for review October 4, 2026 09:03
claude added 2 commits October 4, 2026 09:06
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

@cursor cursor 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.

Stale Bugbot comment from a previous run.

Comment thread website/scripts/vercel-ignore.sh Outdated
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
claude added 2 commits October 4, 2026 11:20
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

@cursor cursor 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.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ 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.

Comment thread website/scripts/vercel-ignore.sh
Comment thread website/scripts/vercel-ignore.sh Outdated
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
claude added 2 commits October 4, 2026 14:06
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
@ntucker
ntucker merged commit faef99c into master Oct 4, 2026
22 checks passed
@ntucker
ntucker deleted the cursor/limit-website-builds-9a5a branch October 4, 2026 14:17

This branch was successfully deployed

1 active deployment
Preview — 56fec305 Deployed Oct 4, 2026 by vercel[bot]
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.

3 participants