ci(commitlint): check PR commits against PR base ref#8234
Merged
soyuka merged 1 commit intoJun 3, 2026
Conversation
…lt branch
The workflow uses `actions/checkout@v6` on `pull_request_target` without a
`ref:` argument. That defaults to the target repo's default branch (`main`),
not the PR's base ref. The shell step then computes `merge-base HEAD pr_head`
where HEAD is `main` and walks `rev-list` forward to pick the "first PR
commit". Because `main` and `4.3` diverged long ago, the walk picks the
oldest `4.3` commit since divergence rather than the actual first PR commit,
making commitlint fail on every PR against `4.3` (currently flagging
`fix(graphiql): ...` whose scope is not in `.commitlintrc`).
Set `ref: ${{ github.event.pull_request.base.ref }}` on the checkout step so
HEAD is the PR's actual base. The existing merge-base + rev-list logic is
then correct.
Fixes the commitlint check failing on every PR against 4.3 by flagging unrelated 4.3 commits.
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
.github/workflows/commitlint.ymlusesactions/checkout@v6with noref:argument. Forpull_request_targetevents, that defaults to the target repo's default branch (main), not the PR base.The workflow then computes
merge-base HEAD pr_headwhere HEAD=main and walksrev-listforward to pick the "first PR commit". Because main and 4.3 diverged long ago, that walk picks the oldest 4.3 commit since divergence — currentlyfix(graphiql): migrate to v5 via esm.sh CDN (#8209). Scopegraphiqlis not in.commitlintrc→ the check fails on every PR against 4.3.Fix
Set
ref: ${{ github.event.pull_request.base.ref }}on the checkout step so HEAD becomes the PR's actual base (e.g.4.3). The existing shell logic for merge-base + rev-list is then correct.Reproduction
Any PR against
4.3since the workflow landed has hit this — see commitlint runs on #8226, #8229–#8233.Test plan
ci(commitlint): ...message).