Skip to content

Commit c8ee132

Browse files
committed
ci: add commitlint
1 parent 7d5a0ab commit c8ee132

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

.github/workflows/commitlint.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: CI
2+
3+
on: [push, pull_request]
4+
5+
permissions:
6+
contents: read
7+
8+
jobs:
9+
commitlint:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
with:
14+
fetch-depth: 0
15+
16+
- name: Setup node
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: lts/*
20+
21+
- name: Install commitlint
22+
run: npm install -D @commitlint/cli @commitlint/config-conventional
23+
24+
- name: Setup commitlint
25+
run: echo "export default { extends: ['@commitlint/config-conventional'] };" > commitlint.config.js
26+
27+
- name: Print versions
28+
run: |
29+
git --version
30+
node --version
31+
npm --version
32+
npx commitlint --version
33+
34+
- name: Validate current commit (last commit) with commitlint
35+
if: github.event_name == 'push'
36+
run: npx commitlint --last --verbose
37+
38+
- name: Validate PR commits with commitlint
39+
if: github.event_name == 'pull_request'
40+
run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose

0 commit comments

Comments
 (0)