-
Notifications
You must be signed in to change notification settings - Fork 0
42 lines (38 loc) · 1.31 KB
/
pr_checks.yml
File metadata and controls
42 lines (38 loc) · 1.31 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: Pull Request
on:
pull_request:
types:
- opened
- edited
- reopened
- synchronize
- labeled
merge_group:
permissions: {}
jobs:
check-pr-title:
name: Title Format
runs-on: dind-small
permissions:
pull-requests: read
env:
TITLE: ${{ github.event.pull_request.title }}
steps:
- if: ${{ github.event_name != 'merge_group' }}
run: |
# Enforce "action(target): description" format
# - action is one of {feat, fix, chore, build, ci, docs, style, refactor, perf, test}
# - exactly one target using [A-Za-z0-9-]+
# - requires a non-empty description (at least one non-space char after ": ")
regex='^(feat|fix|chore|build|ci|docs|style|refactor|perf|test)\([A-Za-z0-9-]+\):[[:space:]]+[^[:space:]].*$'
if [[ "$TITLE" =~ $regex ]]; then
echo "Title format is correct."
else
echo "Title format does not match the conventions:"
echo " action(target): description"
echo "Allowed actions: feat, fix, chore, build, ci, docs, style, refactor, perf, test."
echo "Examples:"
echo " feat(wallet): add hardware signing"
echo " fix(api): handle 401 on refresh"
exit 1
fi