-
-
Notifications
You must be signed in to change notification settings - Fork 12
38 lines (32 loc) · 1.14 KB
/
commitlint.yml
File metadata and controls
38 lines (32 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
name: Commitlint
on:
pull_request:
types: [opened, edited, synchronize]
jobs:
commitlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Check PR title
env:
PR_TITLE: ${{ github.event.pull_request.title }}
run: |
# Conventional commit pattern: type(scope)?: description
pattern='^(feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert)(\([a-z0-9-]+\))?: .+'
if [[ ! "$PR_TITLE" =~ $pattern ]]; then
echo "❌ PR title does not follow conventional commits format"
echo ""
echo "Expected: <type>: <description>"
echo "Got: $PR_TITLE"
echo ""
echo "Valid types: feat, fix, docs, style, refactor, perf, test, chore, ci, build, revert"
echo ""
echo "Examples:"
echo " feat: add new feature"
echo " fix: resolve memory leak"
echo " feat(parser): add ruby support"
exit 1
fi
echo "✅ PR title follows conventional commits: $PR_TITLE"