Skip to content

Commit c016239

Browse files
committed
ci: Add Conventional Commits linter for CI
1 parent 689fe74 commit c016239

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

.github/workflows/commit-linter.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: commit-linter
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [main]
7+
8+
jobs:
9+
commit-lint:
10+
runs-on: ubuntu-22.04
11+
steps:
12+
- uses: actions/checkout@v4
13+
with:
14+
fetch-depth: 0
15+
16+
- uses: cachix/install-nix-action@v25
17+
with:
18+
nix_path: nixpkgs=channel:nixos-unstable
19+
20+
- uses: DeterminateSystems/magic-nix-cache-action@main
21+
22+
- name: npm install
23+
run: nix develop --command npm install --include=dev
24+
25+
- name: Print versions
26+
run: |
27+
git --version
28+
node --version
29+
npm --version
30+
npx commitlint --version
31+
32+
- name: Validate current commit (last commit) with commitlint
33+
if: github.event_name == 'push'
34+
run: nix develop --command npx commitlint --last --verbose
35+
36+
- name: Validate PR commits with commitlint
37+
if: github.event_name == 'pull_request'
38+
run: nix develop --command 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)