fix(ci): restore merge base for three-dot diffs broken by shallow clones - #3865
Merged
Merged
Conversation
The shallow-clone optimization in facebook#1379 (5cf9420) set the default fetch-depth of 1 on the check-components and build jobs while their change detection still uses three-dot diffs (origin/main...HEAD), which require the merge base to exist locally. On a depth-1 clone the diff fails with "fatal: no merge base" and both consumers swallowed it: - check-components: the failed diff piped through grep/head yields an empty string, so has_components=false and pr-a11y is silently skipped on every PR. - build: analyze-pr.js caught the error and returned [], so the PR Analysis Report always posted "New components: none / Modified components: none". Fix, following the depth-50 pattern already proven by check-scope in the same file: - check-components + build: fetch-depth: 50 on checkout and --depth=50 on the base fetch. - check-components: explicit merge-base guard that fails open (has_components=true, with a ::warning) instead of silently skipping the a11y audit if the clone is ever too shallow again. - analyze-pr.js: a failed diff now exits non-zero with ::error instead of being reported as "no changes". Verified with a local bare-repo simulation replicating the actions/checkout fetch pattern: depth 1 reproduces "fatal: no merge base" -> has_components=false; depth 50 finds the merge base and detects the changed component.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
PR Analysis ReportNo new or modified components detected. Bundle Size Summary
Accessibility AuditStatus: No accessibility violations detected. Generated by PR Enrichment workflow | View full report |
cixzhang
approved these changes
Jul 12, 2026
Contributor
Author
Contributor
|
Hmm I can't seem to merge it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The shallow-clone optimization in #1379 (5cf9420) left
check-componentsandbuildon the defaultfetch-depth: 1plus a--depth=1base fetch, while their change detection still uses three-dot diffs (origin/main...HEAD) — which need the merge base to exist locally. On a depth-1 clone the diff dies withfatal: no merge base, and both consumers swallow the error:check-components: the failed diff piped throughgrep | headyields an empty string, sohas_components=false— andpr-a11yis skipped. Measured: in the 15 most recent PR CI runs,pr-a11yexecuted zero times — skipped in all 12 completed runs (the remaining 3 are currently queued/in-progress or awaiting fork approval). The accessibility audit has been silently disabled since ci: optimize PR workflow — deduplicate build, shallow clones #1379 landed (~3 months).build:analyze-pr.jscatches the diff error and returns[], so the PR Analysis Report comment posts "New components: none / Modified components: none" on every PR, regardless of what actually changed.The fix reuses the pattern already proven by
check-scopein the same file (fetch-depth: 50+ base fetch--depth=50), which has been working correctly all along.Changes
check-components:fetch-depth: 50on checkout + base fetch--depth=50(was depth 1/1). Added an explicit merge-base guard that fails open — if the clone is ever too shallow again it setshas_components=truewith a::warningso the audit runs instead of silently skipping.build: same depth alignment (fetch-depth: 50+ base fetch--depth=50) soanalyze-pr.js's three-dot diff can resolve the merge base.analyze-pr.js: a failedgit diff base...headnow exits non-zero with a::errorannotation instead of being reported as an empty (legitimate-looking) analysis. Header@outputupdated accordingly.Test plan
Verified with a local bare-repo simulation that replicates the
actions/checkoutfetch pattern (git init+remote add+fetch --depth=N, notgit clone --depthwhich implies--single-branch): aprbranch forking frommain~3with 30+ commits of history, touchingpackages/core/src/Button/.git diff origin/main...HEADfails withfatal: origin/main...HEAD: no merge base(exit 128); the currentcheck-componentspipeline swallows it and emitshas_components=falseeven though the PR modified Buttonpackages/core/src/Button/Button.tsx,has_components=trueanalyze-pr.jsat depth 1 now exits 1 with::error::git diff origin/main...HEAD failed: …instead of writing an empty analysisanalyze-pr.jsat depth 50 exits 0 and reports{"newComponents":[],"modifiedComponents":["Button"]}ci.ymlparses as valid YAML; all three PR jobs (check-scope,check-components,build) now consistently usefetch-depth: 50+ base fetch--depth=50(grep-verified)node --check .github/scripts/analyze-pr.jspasses