Skip to content

ci(commitlint): 470 — gate Conventional Commits type at PR time - #106

Draft
randomdevpete wants to merge 1 commit into
masterfrom
task-470-enforce-conventional-commit-types
Draft

ci(commitlint): 470 — gate Conventional Commits type at PR time#106
randomdevpete wants to merge 1 commit into
masterfrom
task-470-enforce-conventional-commit-types

Conversation

@randomdevpete

Copy link
Copy Markdown
Owner

Summary

Adds commitlint enforcement at PR time so untyped and miscased commits cannot reach master. The CI job runs only on pull_request events and checks the exact range the PR adds, using @commitlint/config-conventional's type-enum, type-case and type-empty rules — the same type set semantic-release's commit-analyzer recognises.

Style exceptions left standing

Four rules from @commitlint/config-conventional are disabled in commitlint.config.cjs because they would flag this project's normal prose patterns rather than genuine issues:

  • header-max-length: The longest current commit header is 101 characters (e.g. refactor(demos): source is always shown - drop the accordion, add a filename heading linked to GitHub). Disabling lets legitimate long subjects through.
  • body-max-line-length / footer-max-line-length: Disabled to allow long lines when quoting documentation or file paths.
  • subject-case: Disabled to allow proper nouns naturally appearing in subjects (e.g. feat(foo): Add GitHub support — the capitalised "GitHub" would otherwise violate lowercase enforcement).

No local commit-msg hook

Deliberately omitted. The branch-base.sh init hook in <root>/TODOS/scripts/ installs a shared commit-msg hook that appends the Ticket: trailer, required for fork-point tracking in every worktree. Composing a second commitlint hook locally was judged riskier than it is worth, and every landing goes through a PR anyway, where the CI job gates the format. The hook remains in CI only.

Producer's validation

Adds commitlint.config.cjs, wired into a new commitlint CI job that lints
every commit a PR adds over its base against @commitlint/config-conventional's
type-enum/type-case/type-empty rules. An untyped or miscased commit
(`Style:`) now fails before it can reach master; commit-analyzer's
type-to-bump mapping otherwise silently drops such commits from every
release. Line-length and subject-case rules are disabled — they flag this
project's normal prose, not the type prefix. Documents the new gate in
docs/release-strategy.md alongside the existing release-cadence docs.

Ticket: 470
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