Skip to content

Commit

Permalink
fix: add commitlint as husky pre-commit hook and ci check (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
T1B0 authored Jan 14, 2025
1 parent 0481084 commit 5dbac10
Show file tree
Hide file tree
Showing 6 changed files with 756 additions and 18 deletions.
6 changes: 0 additions & 6 deletions .commitlintrc.json

This file was deleted.

23 changes: 19 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,25 @@ jobs:
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
- run: npm ci
- run: npm run lint
- run: npm run build
- run: npm run test
- name: install dependencies
run: npm ci --ignore-scripts # don't install husky hooks when in ci

- name: Validate current commit (last commit) message with commitlint
if: github.event_name == 'push'
run: npx commitlint --last --verbose

- name: Validate PR commits messages with commitlint
if: github.event_name == 'pull_request'
run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose

- name: lint typescript code
run: npm run lint

- name: build typescript
run: npm run build

- name: run unit test
run: npm run test

### Integration tests

Expand Down
1 change: 1 addition & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npm run commitlint ${1}
7 changes: 7 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default {
extends: ['@commitlint/config-conventional'],
rules: {
"scope-case": [2, "always", ["lower-case", "upper-case", "camel-case"]],
"footer-max-line-length": [2 ,"always", [256]]
}
};
Loading

0 comments on commit 5dbac10

Please sign in to comment.