Repository navigation
fix(ci): make ci scopes --base origin/main work on a shallow clone - #1880
Merged
Conversation
Contributor
Merge Protections🟢 All 6 merge protections satisfied — ready to merge. Show 6 satisfied protections🟢 🤖 Continuous Integration
🟢 👀 Review Requirements
🟢 Enforce conventional commitMake sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
🟢 🔎 Reviews
🟢 📕 PR description
🟢 🚦 Auto-queueWhen all merge protections are satisfied, this pull request will be queued automatically. |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Unrelated shallow boundaries can break fetches from origin, and filesystem errors lose their typed causes.
Review effort: Balanced
Findings: 2
Open (2)
What changed in this PR
Fixes ci scopes --base origin/main --head HEAD on shallow checkouts.
Changes:
- Normalizes remote-tracking names for fetch requests.
- Includes shallow boundary commits during history deepening.
- Adds regression tests for shallow checkouts and local commits.
| File | Description |
|---|---|
| crates/mergify-ci/src/scopes_detect/changed_files.rs | Updates fetch handling and adds shallow-history regression tests. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
`mergify ci scopes --base origin/main --head HEAD` is the invocation the mergify-ci skill documents. Under `actions/checkout`'s default `fetch-depth: 1` it failed the step with a git error instead of emitting scopes, for two reasons: - The fetch asked the remote for `origin/main`, a name only a clone knows: "fatal: couldn't find remote ref origin/main". A leading `origin/` (or `remotes/origin/`, `refs/remotes/origin/`) is now stripped from the fetch source; the local ref name is unchanged. `feature/x` is left alone, only the remote we fetch from counts as a prefix. - With that fixed, `--deepen` only deepened `main`. HEAD is never fetched by name, so its depth-1 boundary kept hiding its parents and the loop ended with "cannot find a common ancestor". The `--deepen` rounds now also ask for every commit listed in the clone's `shallow` file, so each boundary moves, HEAD's included. The boundary commits rather than HEAD's SHA: they all came from the remote, while HEAD can be a commit made on top of the checkout, which the remote refuses and which would fail the whole fetch. They join only the `--deepen` rounds, never the first `--depth` one, which would cut a history the checkout already has. Pull request events with a head SHA were not affected: both SHAs are fetched. The other auto-detected references that use `HEAD` as head (the `HEAD^` fallback outside GitHub Actions, a push without `before`) get the boundary deepening too. Fixes MRGFY-8290 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Change-Id: If4ba206ad2a6f84fe06a47ba62c1e9149b95c104
Member
Author
Revision history
|
sileht
force-pushed
the
devs/sileht/mrgfy-8290-scopes-shallow-clone/make-ci-scopes-base-origin-main-work-shallow-clone--f4ba206a
branch
from
October 5, 2026 14:13
836fb83 to
2511f5c
Compare
JulianMaurin
approved these changes
Oct 5, 2026
remyduthu
approved these changes
Oct 5, 2026
Contributor
Merge Queue Status
This pull request spent 9 minutes 3 seconds in the queue, including 8 minutes 21 seconds running CI. Required conditions to merge
|
34 of 40 tasks
mergify
Bot
deleted the
devs/sileht/mrgfy-8290-scopes-shallow-clone/make-ci-scopes-base-origin-main-work-shallow-clone--f4ba206a
branch
October 5, 2026 15:11
This branch was successfully deployed
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.

mergify ci scopes --base origin/main --head HEADis the invocation themergify-ci skill documents. Under
actions/checkout's defaultfetch-depth: 1it failed the step with a git error instead of emittingscopes, for two reasons:
origin/main, a name only a cloneknows: "fatal: couldn't find remote ref origin/main". A leading
origin/(orremotes/origin/,refs/remotes/origin/) is nowstripped from the fetch source; the local ref name is unchanged.
feature/xis left alone, only the remote we fetch from counts as aprefix.
--deepenonly deepenedmain. HEAD is neverfetched by name, so its depth-1 boundary kept hiding its parents and
the loop ended with "cannot find a common ancestor". The
--deepenrounds now also ask for every commit listed in the clone's
shallowfile, so each boundary moves, HEAD's included.
The boundary commits rather than HEAD's SHA: they all came from the
remote, while HEAD can be a commit made on top of the checkout, which
the remote refuses and which would fail the whole fetch. They join only
the
--deepenrounds, never the first--depthone, which would cut ahistory the checkout already has.
Pull request events with a head SHA were not affected: both SHAs are
fetched. The other auto-detected references that use
HEADas head(the
HEAD^fallback outside GitHub Actions, a push withoutbefore)get the boundary deepening too.
Fixes MRGFY-8290
Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com