Skip to content

Commit 46a974b

Browse files
chore: check PR title instead of commits (#74)
1 parent 675c112 commit 46a974b

File tree

3 files changed

+33
-15
lines changed

3 files changed

+33
-15
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,6 @@ on:
77
branches: ['**']
88

99
jobs:
10-
commitlint:
11-
if: github.event_name == 'pull_request'
12-
name: Commit Naming
13-
runs-on: ubuntu-latest
14-
steps:
15-
- uses: actions/checkout@v4
16-
with:
17-
fetch-depth: 0
18-
- uses: actions/setup-node@v4
19-
with:
20-
node-version: 18
21-
cache: npm
22-
- run: npm ci
23-
- run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose
2410
verify_files:
2511
name: Verify Files
2612
runs-on: ubuntu-latest

.github/workflows/pr-title.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: PR Title
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- synchronize
8+
- reopened
9+
- edited
10+
11+
jobs:
12+
verify_title:
13+
name: Verify Title
14+
runs-on: ubuntu-latest
15+
if: ${{github.event.action != 'edited' || github.event.changes.title}}
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
- name: Setup Node
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: 18
23+
cache: npm
24+
- name: Install Packages
25+
run: npm ci
26+
- name: Run Commitlint
27+
run: echo "${{github.event.pull_request.title}}" | npx commitlint

commitlint.config.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1-
module.exports = {extends: ['@commitlint/config-conventional']};
1+
module.exports = {
2+
extends: ['@commitlint/config-conventional'],
3+
rules: {
4+
'header-max-length': [2, 'always', 72],
5+
},
6+
};

0 commit comments

Comments
 (0)