Skip to content

Commit f26475e

Browse files
committed
ci: add commitlint GitHub Actions
1 parent 8a295f0 commit f26475e

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

.github/workflows/commitlint.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Conventional Commitlint
2+
3+
on:
4+
push:
5+
pull_request:
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
commitlint:
13+
name: Commitlint
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Setup Node
22+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
23+
with:
24+
node-version: lts/*
25+
cache: yarn
26+
27+
- name: Install dependencies
28+
run: yarn install --ignore-engines --frozen-lockfile
29+
30+
- name: Build packages
31+
run: yarn build
32+
33+
- name: Print versions
34+
run: |
35+
git --version
36+
node --version
37+
npm --version
38+
yarn --version
39+
yarn commitlint --version
40+
41+
- name: Create commitlint.config.js
42+
run: |
43+
echo "export default { extends: ['@commitlint/config-conventional'] };" > commitlint.config.js
44+
45+
- name: Validate current commit (last commit) with commitlint
46+
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
47+
run: yarn commitlint --last --verbose
48+
49+
- name: Validate PR commits with commitlint
50+
if: github.event_name == 'pull_request'
51+
run: yarn commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose

0 commit comments

Comments
 (0)