Skip to content

Commit a2e8930

Browse files
authored
chore(ci): add conventional commit message check (#339)
1 parent f7e3bde commit a2e8930

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: "PR Title Check"
2+
3+
on:
4+
pull_request:
5+
types: [opened, edited, synchronize, reopened]
6+
branches:
7+
- master
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
conventional-pr-title:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Validate pull request title
18+
env:
19+
PR_TITLE: ${{ github.event.pull_request.title }}
20+
run: |
21+
pattern='^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\([[:alnum:]_.-]+\))?(!)?: .+$'
22+
23+
if [[ ! "$PR_TITLE" =~ $pattern ]]; then
24+
echo "PR title must follow Conventional Commits, for example: feat(ui): add route summary"
25+
echo "Got: $PR_TITLE"
26+
exit 1
27+
fi

0 commit comments

Comments
 (0)