Skip to content

Commit 9b32b92

Browse files
authored
feat: add commitlint action (#23)
1 parent 2642fb2 commit 9b32b92

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

.commitlintrc.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"rules": {
3+
"header-max-length": [
4+
2,
5+
"always",
6+
72
7+
],
8+
"type-enum": [
9+
2,
10+
"always",
11+
[
12+
"docs",
13+
"feat",
14+
"fix",
15+
"refactor",
16+
"revert",
17+
"style",
18+
"test"
19+
]
20+
],
21+
"type-empty": [
22+
2,
23+
"never"
24+
]
25+
}
26+
}

.github/workflows/commitlint.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: CI
2+
on: [push, pull_request]
3+
jobs:
4+
commitlint:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- uses: actions/checkout@v3
8+
with:
9+
fetch-depth: 0
10+
- name: Install commitlint
11+
run: |
12+
npm install conventional-changelog-conventionalcommits
13+
npm install commitlint@latest
14+
- name: Print versions
15+
run: |
16+
git --version
17+
node --version
18+
npm --version
19+
npx commitlint --version
20+
- name: Validate current commit (last commit) with commitlint
21+
if: github.event_name == 'push'
22+
run: npx commitlint --from HEAD~1 --to HEAD --verbose
23+
- name: Validate PR commits with commitlint
24+
if: github.event_name == 'pull_request'
25+
run: npx commitlint --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to ${{ github.event.pull_request.head.sha }} --verbose

0 commit comments

Comments
 (0)