Skip to content

Commit 2a37e9c

Browse files
authored
feat: Enforce conventional commits via commitlint CaSe iNSeNSiTiVeLY(CopilotKit#2973)
1 parent 5f7e757 commit 2a37e9c

5 files changed

Lines changed: 654 additions & 2 deletions

File tree

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: commitlint
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
commitlint:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0
17+
18+
- name: Setup pnpm
19+
uses: pnpm/action-setup@v4
20+
with:
21+
version: "9.5"
22+
23+
- name: Use Node.js 20
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: 20.x
27+
cache: "pnpm"
28+
cache-dependency-path: "**/pnpm-lock.yaml"
29+
30+
- name: Install dependencies
31+
run: pnpm install --frozen-lockfile
32+
33+
- name: Validate current commit (last commit) with commitlint
34+
if: github.event_name == 'push'
35+
run: npx commitlint --last --verbose
36+
37+
- name: Validate PR commits with commitlint
38+
if: github.event_name == 'pull_request'
39+
run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose

.husky/commit-msg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npx --no -- commitlint --edit "$1"

commitlint.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
extends: ['@commitlint/config-conventional'],
3+
rules: {
4+
'subject-case': [0],
5+
},
6+
};

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
"author": "",
1212
"license": "ISC",
1313
"devDependencies": {
14+
"@commitlint/cli": "^20.3.0",
15+
"@commitlint/config-conventional": "^20.3.0",
1416
"danger": "^12.3.3",
1517
"husky": "^9.1.4"
1618
},

0 commit comments

Comments
 (0)