Skip to content

Commit b85b3cc

Browse files
authored
chore: add github pr title check github action workflow (#610)
1 parent 37ca15d commit b85b3cc

File tree

2 files changed

+84
-0
lines changed

2 files changed

+84
-0
lines changed

.github/.commitlintrc.json

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{
2+
"extends": [
3+
"@commitlint/config-conventional"
4+
],
5+
"rules": {
6+
"type-enum": [
7+
2,
8+
"always",
9+
[
10+
"feat",
11+
"fix",
12+
"docs",
13+
"style",
14+
"refactor",
15+
"perf",
16+
"test",
17+
"build",
18+
"ci",
19+
"chore",
20+
"revert"
21+
]
22+
],
23+
"type-case": [
24+
2,
25+
"always",
26+
"lower-case"
27+
],
28+
"type-empty": [
29+
2,
30+
"never"
31+
],
32+
"scope-case": [
33+
2,
34+
"always",
35+
"lower-case"
36+
],
37+
"subject-empty": [
38+
2,
39+
"never"
40+
],
41+
"subject-full-stop": [
42+
2,
43+
"never",
44+
"."
45+
],
46+
"header-max-length": [
47+
2,
48+
"always",
49+
100
50+
]
51+
}
52+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Title Check
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- edited
8+
- synchronize
9+
- reopened
10+
11+
jobs:
12+
title-check:
13+
name: Title Check
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout repo
17+
uses: actions/checkout@v4
18+
19+
- name: Setup Node.js
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: "20"
23+
24+
- name: Install commitlint
25+
run: |
26+
npm install --save-dev @commitlint/config-conventional @commitlint/cli
27+
28+
- name: Validate PR title
29+
env:
30+
PR_TITLE: ${{ github.event.pull_request.title }}
31+
run: |
32+
echo "$PR_TITLE" | npx commitlint -g .github/.commitlintrc.json

0 commit comments

Comments
 (0)