Skip to content

Commit 48cad1f

Browse files
authored
ci: Add conventional commits linting (#147)
- Add commit-lint job to CI workflow that validates conventional commits - Configure commitlint with @commitlint/config-conventional - Add Node.js/pnpm setup for running commitlint in CI - Handle both push events (last commit) and pull requests (range validation) - Customize subject-case rule to prevent restrictive casing enforcement - The idea behind using conventional commits is to have a nice-looking changelog for users
1 parent 375f40d commit 48cad1f

File tree

5 files changed

+842
-0
lines changed

5 files changed

+842
-0
lines changed

.github/workflows/ci.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,29 @@ jobs:
6060
with:
6161
command: nextest
6262
args: run --all-features --profile ci
63+
64+
commit-lint:
65+
name: Verify Conventional Commits
66+
runs-on: ubuntu-latest
67+
strategy:
68+
matrix:
69+
node-version: [20]
70+
steps:
71+
- uses: actions/checkout@v4
72+
with:
73+
fetch-depth: 0
74+
- name: Install pnpm
75+
uses: pnpm/action-setup@v4
76+
- name: Use Node.js ${{ matrix.node-version }}
77+
uses: actions/setup-node@v4
78+
with:
79+
node-version: ${{ matrix.node-version }}
80+
cache: "pnpm"
81+
- name: Install dependencies
82+
run: pnpm install
83+
- name: Validate current commit (last commit) with commitlint
84+
if: github.event_name == 'push'
85+
run: pnpm commitlint --last --verbose
86+
- name: Validate PR commits with commitlint
87+
if: github.event_name == 'pull_request'
88+
run: pnpm commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
/*.wasm
22
/target
33
grammars/
4+
5+
# Node.js stuff
6+
/node_modules/

commitlint.config.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
export default {
2+
extends: ["@commitlint/config-conventional"],
3+
rules: {
4+
"subject-case": [
5+
2,
6+
"never",
7+
[
8+
"lower-case",
9+
"upper-case",
10+
"camel-case",
11+
"kebab-case",
12+
"pascal-case",
13+
"snake-case",
14+
"start-case",
15+
],
16+
],
17+
},
18+
};

package.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"name": "zed-ruby",
3+
"private": true,
4+
"type": "module",
5+
"packageManager": "pnpm@10.13.1",
6+
"devDependencies": {
7+
"@commitlint/cli": "^19.8.1",
8+
"@commitlint/config-conventional": "^19.8.1"
9+
}
10+
}

0 commit comments

Comments
 (0)