Repository navigation
ci: lint commit messages and pull request titles - #56
Merged
Merged
Conversation
Most recent commits follow "type: what changed", but nothing kept it that way: 3 of the 23 since 1.5.0 do not. A pull request now fails when a commit or its title does not, checked by a small script with no dependencies. It runs in its own workflow, which also reruns when a title is edited, so renaming a pull request does not cancel and restart the whole CI run. Merge and revert commits git writes itself pass, and fixup! commits pass the local hook but not the pull request check. Older history is not checked. The same script runs locally with npm run lint:commits, or on every commit with git config core.hooksPath .githooks.
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.
Recent commits follow
type: what changed(feat:,fix:,ci:...), but nothing enforced it, and 3 of the 23 commits since 1.5.0 slipped through. This makes a pull request fail when one of its commits, or its title, does not.What is checked
feat,fix,docs,test,refactor,perf,security,ci,build,chore,styleorrevert. A scope likefeat(dashboard):and a breaking-change!are allowed.fixup!commits pass the local hook but fail the pull request, so they get squashed first.Older history is not checked.
Where it runs
Commit messagesworkflow checks every commit in the pull request and its title. It is separate from CI so that editing a title reruns only this check, instead of cancelling and restarting the Docker builds.npm run lint:commitschecks the branch againstorigin/master.git config core.hooksPath .githooks.It is one script,
scripts/commitlint.js, with no dependencies. Documented indocs/building.md.Tested
9 new tests, full suite and lint pass. Run over
1.5.0..1.6.1it flags exactly the three badge commits. The hook refusedAdd commit lintand accepted this commit.