ci: stop re-shallowing origin/main in commitlint job#1173
Merged
olu-duffel merged 1 commit intoJun 15, 2026
Conversation
The Commitlint job checks out with `fetch-depth: 0` (full history), but a follow-up `git fetch origin main --depth=1` step re-shallowed the `origin/main` ref to a single commit. That destroyed the merge-base between the PR branch and main, so `commitlint --from origin/main` resolved to the entire repo history and failed on old, pre-convention commits instead of just the PR's commits. Remove the redundant shallow fetch — `fetch-depth: 0` already provides `origin/main` with full history, so the merge-base resolves correctly.
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.
Problem
The
Commitlintjob fails on PRs whose branch is behindmain, reporting errors on old, pre-convention commits (e.g.chore(release): 1.8.0,[STAYS-521] Add cancel booking to Stays) rather than the PR's own commits.Root cause
The job checks out with
fetch-depth: 0(full history), but then runs:That
--depth=1fetch re-shallows theorigin/mainref to a single commit, throwing away the full historyfetch-depth: 0had just provided. With no common ancestor in the local history,commitlint --from origin/maincan't compute the merge-base and instead lints the entire repo history — failing on legacy commits.Fix
Remove the redundant shallow-fetch step.
fetch-depth: 0already makesorigin/mainavailable with full history, so the merge-base resolves and commitlint lints only the PR's commits.Seen on #1165, where the Commitlint check failed on unrelated historical commits.