Commit 8a2aca0
ci: skip merge commits in commit-message lint (#90)
## 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 `main` into a feature branch is squashed away
at
merge time and never reaches `main`. The rule therefore guards nothing
while
failing the CI check for every PR that synced `main` via a merge commit
(observed on #82).
The fix makes `scripts/check_commit_messages.py` gather only non-merge
commits by passing `--no-merges` to its `git log` call, mirroring
commitlint's own default of ignoring merge commits. The `Merge ` rule in
`commit_lint.py` is left intact as belt-and-suspenders (it is also
reused by
the PR-title path), so no lint behavior is removed.
## Type
- [ ] Fix
- [ ] Feature
- [ ] Docs
- [x] CI / tooling
- [ ] Refactor
- [ ] Other
## Verification
- `uv run pytest tests/test_check_commit_messages.py
tests/test_commit_lint.py -q` -> 10 passed
- `uv run ruff check scripts/check_commit_messages.py
tests/test_check_commit_messages.py` -> All checks passed
- Added TDD coverage in `tests/test_check_commit_messages.py`: builds a
real
temporary repo with a `--no-ff` merge commit and asserts the range
passes
(red before the fix, green after).
- [x] Relevant tests pass locally
- [x] Relevant lint / type checks pass locally
- [ ] User-facing docs or screenshots are updated when needed
## Risk
- [x] Security impact considered
- [x] Backward compatibility considered
- [x] Rollback path is clear for risky changes
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-merges` flag.
## Related Issues
N/A
Co-authored-by: Claude (claude-opus-4-8) <noreply@anthropic.com>
Co-authored-by: Sheng Zhao <sheng.zhao@evermind.ai>
Co-authored-by: Claude (claude-opus-4-8) <noreply@anthropic.com>1 parent f827c00 commit 8a2aca0
2 files changed
Lines changed: 57 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
| 48 | + | |
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
0 commit comments