ci: skip merge commits in commit-message lint#90
Merged
Conversation
The commit-message check rejected any Merge commit in the PR range, but the repository is squash-only so merge commits never reach main. Every PR that synced main via a merge commit failed the check for no benefit. Gather only non-merge commits with git log --no-merges, mirroring commitlint's default, while leaving the belt-and-suspenders Merge rule in commit_lint.py intact. Co-authored-by: Claude (claude-opus-4-8) <[email protected]>
cyfyifanchen
approved these changes
Jul 3, 2026
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 commit-message lint rejects any
Merge ...commit in the PR range(
scripts/commit_lint.py: "merge commits are not allowed in PR ranges").But this repository is squash-only (rebase/merge disabled), so a merge
commit created by syncing
maininto a feature branch is squashed away atmerge time and never reaches
main. The rule therefore guards nothing whilefailing the CI check for every PR that synced
mainvia a merge commit(observed on #82).
The fix makes
scripts/check_commit_messages.pygather only non-mergecommits by passing
--no-mergesto itsgit logcall, mirroringcommitlint's own default of ignoring merge commits. The
Mergerule incommit_lint.pyis left intact as belt-and-suspenders (it is also reused bythe PR-title path), so no lint behavior is removed.
Type
Verification
uv run pytest tests/test_check_commit_messages.py tests/test_commit_lint.py -q-> 10 passeduv run ruff check scripts/check_commit_messages.py tests/test_check_commit_messages.py-> All checks passedAdded TDD coverage in
tests/test_check_commit_messages.py: builds a realtemporary repo with a
--no-ffmerge commit and asserts the range passes(red before the fix, green after).
Relevant tests pass locally
Relevant lint / type checks pass locally
User-facing docs or screenshots are updated when needed
Risk
Backward compatible: real commit messages are still linted exactly as
before; only merge commits are now skipped. Rollback is a one-line revert of
the
--no-mergesflag.Related Issues
N/A
Co-authored-by: Claude (claude-opus-4-8) [email protected]