Repository navigation
ci(ci): pin commitlint once and run the same hook in CI - #181
Merged
Merged
Conversation
The local hook (third-party rev v9.21.0) resolved @commitlint/cli 19.8.1 with an unpinned config-conventional 20.5.0, while CI installed whatever npm served (21.2.3 of both). Rules such as subject-exclamation-mark behave differently across those majors. Replace the third-party hook with a local node hook that pins cli, config-conventional and Node exactly, and have the Commit Lint workflow run that hook through pre-commit instead of its own npm install. The hook environment is cached on the config's hash. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 13, 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.
Description
Local and CI commitlint had drifted into three different versions:
@commitlint/cliconfig-conventionalv9.21.0ships a^19.7.1range (its lockfile isn't honoured);additional_dependenciesunpinnednpm install -g.pre-commit-config.yaml, Node 24.21.0Rules really do differ across those majors. In 19.x
subject-exclamation-markrejects!:anywhere in the header. In 21.x it only looks right after the type/scope (relevant to #174, which enables that rule).The PR-unique commit selection, which skips merges and anything already on
main, is unchanged. Only the linter invocation moved.Related Issues
Follow-up to #174, where the local and CI commitlint gave different verdicts on the same subject.
Type of Change
Checklist
developbranchCHANGELOG.mdby handCONTRIBUTING.md: project tree comment, where versions are pinned)src/changes, so no unit tests / pytest / ty runTesting
Run locally through pre-commit with the new hook:
node v24.21.0,@commitlint/cli 21.2.3,@commitlint/config-conventional 21.2.3feat(core): add thing→ exit 0 ·nope→ exit 1 (subject-empty,type-empty) ·feat(nosuchscope): add→ exit 0 with thescope-enumwarningcommit-msgtimeMerge danger: two-way door, revert restores the old hook and npm step. The blast radius is contributor setup: on the first commit after pulling, pre-commit builds the new hook environment and downloads Node 24.21.0 once (~30 MB). No system Node is required any more. Versions are no longer updated automatically, so bump cli and config-conventional together by hand.
🤖 Generated with Claude Code