forked from wraith-protocol/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
42 lines (39 loc) · 1.4 KB
/
Copy pathpr-title-lint.yml
File metadata and controls
42 lines (39 loc) · 1.4 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
38
39
40
41
42
name: PR title lint
on:
pull_request:
types:
- opened
- edited
- synchronize
- reopened
jobs:
lint-pr-title:
name: Validate conventional commit title
runs-on: ubuntu-latest
steps:
- name: Check PR title format
env:
PR_TITLE: ${{ github.event.pull_request.title }}
run: |
# Pattern: <type>(<optional scope>): <description>
# Allowed types: feat fix docs chore refactor style
PATTERN='^(feat|fix|docs|chore|refactor|style)(\([a-z0-9/,. -]+\))?: .{1,100}$'
if echo "$PR_TITLE" | grep -qE "$PATTERN"; then
echo "PR title is valid: $PR_TITLE"
else
echo "::error::PR title does not follow Conventional Commits format."
echo ""
echo " Got: $PR_TITLE"
echo ""
echo " Expected format: <type>(<scope>): <description>"
echo " Allowed types: feat | fix | docs | chore | refactor | style"
echo ""
echo " Examples:"
echo " feat(guides): add stellar multisig withdrawal guide"
echo " fix(sdk): correct Chain enum example"
echo " docs: expand CONTRIBUTING with branch model"
echo " chore(ci): pin actions/checkout to v4"
echo ""
echo " See CONTRIBUTING.md for the full commit message guide."
exit 1
fi