Skip to content

ci: lint commit messages and pull request titles - #56

Merged
xiaodoudou merged 1 commit into
masterfrom
ci/commit-lint
Oct 18, 2026
Merged

xiaodoudou merged 1 commit into
masterfrom
ci/commit-lint

Conversation

@xiaodoudou

Copy link
Copy Markdown
Owner

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

  • The first line starts with a type: feat, fix, docs, test, refactor, perf, security, ci, build, chore, style or revert. A scope like feat(dashboard): and a breaking-change ! are allowed.
  • Something after the colon, no full stop at the end, at most 100 characters (the longest title merged so far is exactly 100).
  • A blank line between the subject and the body.
  • Merge and revert commits git writes itself pass. fixup! commits pass the local hook but fail the pull request, so they get squashed first.

Older history is not checked.

Where it runs

  • Pull requests: a new Commit messages workflow 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.
  • Locally: npm run lint:commits checks the branch against origin/master.
  • On every commit (opt-in): git config core.hooksPath .githooks.

It is one script, scripts/commitlint.js, with no dependencies. Documented in docs/building.md.

Tested

9 new tests, full suite and lint pass. Run over 1.5.0..1.6.1 it flags exactly the three badge commits. The hook refused Add commit lint and accepted this commit.

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.
@xiaodoudou
xiaodoudou merged commit 8b193b1 into master Oct 18, 2026
8 checks passed
@xiaodoudou
xiaodoudou deleted the ci/commit-lint branch October 18, 2026 05:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant