Skip to content

Commit 6333c2b

Browse files
Add CI for commitlint (#13)
* ci: add Github actions workflow job for commitlint Added a Github actions workflow job for linting commit messages on push and PR
1 parent 629fb23 commit 6333c2b

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

.github/workflows/ci.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,34 @@ on:
1717
workflow_dispatch:
1818

1919
jobs:
20+
commitlint:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Clone repo
24+
uses: actions/checkout@v4
25+
26+
- name: Install NodeJS
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: 22.12.0
30+
31+
- name: Cache npm dependencies
32+
uses: actions/cache@v4
33+
with:
34+
path: ~/.npm
35+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
36+
37+
- name: Install dependencies
38+
run: npm ci
39+
40+
- name: Validate current commit (last commit) with commitlint
41+
if: github.event_name == 'push'
42+
run: npx commitlint --last --verbose
43+
44+
- name: Validate PR commits with commitlint
45+
if: github.event_name == 'pull_request'
46+
run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose
47+
2048
lint:
2149
runs-on: ubuntu-latest
2250

0 commit comments

Comments
 (0)