Skip to content

Commit

Permalink
ci(repo): add commitlint
Browse files Browse the repository at this point in the history
add commitlint to lint commit messages via husky and in GitHub via GitHub Actions
  • Loading branch information
jwulf committed Dec 14, 2023
1 parent d9900dd commit 6e9a63e
Show file tree
Hide file tree
Showing 6 changed files with 632 additions and 38 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Commitlint
on: [push, pull_request]

jobs:
lint-commits:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0 # Ensures commit history is fetched

- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: '14' # Specify a Node.js version

- name: Install dependencies
run: npm install

- name: Lint last commit
run: npx commitlint --from=${{ github.event.pull_request.base.sha }} --to=${{ github.head_ref }} --verbose
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx --no-install commitlint --edit $1
3 changes: 3 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
};
6 changes: 5 additions & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
],
"command": {
"publish": {
"registry": "https://npm.pkg.github.com"
"registry": "https://npm.pkg.github.com",
"conventionalCommits": true
},
"version": {
"conventionalCommits": true
}
},
"npmClient": "npm"
Expand Down
Loading

0 comments on commit 6e9a63e

Please sign in to comment.