commitlint#329
Conversation
jamescmartinez
commented
Feb 23, 2026
- chore: set up commitlint via Husky commit-msg hook
- chore: add commitlint to CI
commit: |
There was a problem hiding this comment.
Pull request overview
Sets up commit message linting across the repo by adding commitlint configuration, wiring it into local Git hooks via Husky, and introducing a dedicated CI job to validate commit messages.
Changes:
- Add Husky + commitlint devDependencies and enable Husky via the
preparescript. - Introduce
commitlint.config.jsand acommit-msghook to lint commit messages locally. - Add a
commitlintjob to the GitHub Actions CI workflow.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| package.json | Adds commitlint + Husky dependencies and enables Husky via prepare. |
| package-lock.json | Locks newly added commitlint/Husky dependency tree. |
| eslint.config.js | Excludes commitlint.config.js from ESLint processing. |
| commitlint.config.js | Adds conventional-commits commitlint configuration. |
| .husky/commit-msg | Adds commit-msg hook intended to run commitlint. |
| .github/workflows/ci.yaml | Adds CI job to run commitlint on push/PR commits. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -0,0 +1 @@ | |||
| npx --no -- commitlint --edit $1 | |||
There was a problem hiding this comment.
The hook file lacks a shebang (and the usual Husky bootstrap), so Git may fail to execute it on Unix-like systems with an “Exec format error”. Add the standard #!/usr/bin/env sh header (and, if intended, source .husky/_/husky.sh) so the hook runs reliably across environments.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -0,0 +1,3 @@ | |||
| #!/usr/bin/env sh | |||
There was a problem hiding this comment.
.husky/commit-msg is missing a shebang and Husky bootstrap line. Git hooks are executed as standalone scripts; without #!/usr/bin/env sh (and, for Husky installs, sourcing .husky/_/husky.sh) this hook can fail to run with an “exec format error” or miss Husky’s PATH setup on some environments. Consider also quoting the commit message path argument to be safe.
| #!/usr/bin/env sh | |
| #!/usr/bin/env sh | |
| . "$(dirname -- "$0")/_/husky.sh" |
| - uses: actions/setup-node@v6 | ||
| with: | ||
| node-version-file: package.json | ||
| - run: npm install -D @commitlint/cli @commitlint/config-conventional |
There was a problem hiding this comment.
The commitlint CI job installs commitlint via npm install -D ... even though commitlint is already in devDependencies. This makes the job non-reproducible (can update the lockfile / resolve ranges differently) and slower than necessary; prefer npm ci (or npm ci --ignore-scripts) and then run commitlint from the installed dependencies.
| - run: npm install -D @commitlint/cli @commitlint/config-conventional | |
| - run: npm ci |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |