Skip to content

Commit e53ccf9

Browse files
committed
ci: add commitlint to lint step of CI
1 parent 4e40cc8 commit e53ccf9

File tree

4 files changed

+1605
-275
lines changed

4 files changed

+1605
-275
lines changed

.github/workflows/tests.yml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,35 @@ on:
1414

1515
jobs:
1616
lint:
17-
name: Javascript standard lint
17+
name: Lint commit messages and code
1818
runs-on: ubuntu-latest
1919
steps:
2020
- name: Checkout repository
2121
uses: actions/checkout@v4
2222
with:
2323
persist-credentials: false
2424
show-progress: false
25+
fetch-depth: 0
2526

2627
- name: setup node
2728
uses: actions/setup-node@v4
2829
with:
2930
node-version: 20
3031
cache: npm
31-
- run: npm clean-install
32-
- run: npm run lint
32+
33+
- name: Install npm dependencies
34+
run: npm clean-install
35+
36+
- name: Validate current commit (last commit) with commitlint
37+
if: github.event_name == 'push'
38+
run: npx commitlint --last --verbose
39+
40+
- name: Validate PR commits with commitlint
41+
if: github.event_name == 'pull_request'
42+
run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose
43+
44+
- name: Lint code
45+
run: npm run lint
3346

3447
unittest:
3548
name: unit tests

commitlint.config.mjs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export default {
2+
extends: ['@commitlint/config-conventional'],
3+
rules: {
4+
// disable max body line length - otherwise dependabot can error
5+
'body-max-line-length': [0],
6+
},
7+
};

0 commit comments

Comments
 (0)