Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates CI checkout/fetch behavior to avoid fatal: no merge base failures on fork PRs by switching those runs to a full Git history.
Changes:
- Detect fork PRs by comparing
head.repo.full_nameandbase.repo.full_name. - Use
fetch-depth: 0for fork PRs while retaining shallow fetch for same-repo PRs. - Adjust base SHA fetching to avoid shallow-history merge-base failures on fork PRs.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| changes/9617.fix.md | Adds a changelog entry describing the CI fix. |
| .github/workflows/ci.yml | Implements fork PR detection and conditionally uses full clone / non-shallow base SHA fetch. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
HyeockJinKim
requested changes
Mar 5, 2026
Fork PRs have diverged history from upstream, so the shallow fetch (PR commits + 1) doesn't include enough common ancestors for git merge-base to work. Detect fork PRs by comparing head and base repo names, and use fetch-depth: 0 for full history in that case. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Compute IS_FORK_PR once in the "Calculate the fetch depth" step of each job (lint-and-typecheck, test) and reference the env var in subsequent steps instead of repeating the full_name comparison. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
fatal: no merge baseerrorhead.repo.full_namevsbase.repo.full_namefetch-depth: 0(full clone) for fork PRs in bothlint-and-typecheckandtestjobs, while preserving the existing shallow clone optimization for same-repo PRsWhy full clone instead of requiring fork sync?
Fork PRs may diverge far from upstream, making the shallow clone's history insufficient to find a merge base. While contributors could sync their fork before submitting, requiring this adds unnecessary friction for external contributors. The CI should work regardless of how far the fork has diverged.
Test plan
pants --changed-sincesucceedsResolves BA-4852