Skip to content

Commit 6d86f50

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

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

.github/workflows/commitlint.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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: |
26+
echo "export default { extends: ['@commitlint/config-conventional'] };" > commitlint.config.js
27+
28+
- name: Print versions
29+
run: |
30+
git --version
31+
node --version
32+
npm --version
33+
npx commitlint --version
34+
35+
- name: Validate current commit (last commit) with commitlint
36+
if: github.event_name == 'push'
37+
run: npx commitlint --last --verbose
38+
39+
- name: Validate PR commits with commitlint
40+
if: github.event_name == 'pull_request'
41+
run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose

0 commit comments

Comments
 (0)