-
Notifications
You must be signed in to change notification settings - Fork 7
51 lines (46 loc) · 1.72 KB
/
check-pr-title.yaml
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
43
44
45
46
47
48
49
50
51
name: Check PR title
on:
pull_request:
types:
- opened
- edited
- synchronize
jobs:
check:
runs-on: ubuntu-latest
env:
PR_TITLE: ${{ github.event.pull_request.title }}
steps:
- id: release
name: Check for release PR format
if: startsWith(github.event.pull_request.title, 'Release')
shell: bash
run: |
if ! grep -qP '^Release [0-9]{4}-[0-9]{2}$' <<< "$PR_TITLE"; then
echo "::warning::Release PR title should be: 'Release <year>-<ISO week number>'"
exit 1
fi
- name: Check for Conventional Commit format
shell: bash
if: steps.release.conclusion == 'skipped'
run: |
if ! grep -qP '^\w+(\(\w+\))?:\s' <<< "$PR_TITLE"; then
echo "::warning::PR title should be in Conventional Commit style, e.g. 'feat: ...'"
exit 1
fi
- name: Check for conventional type allow-list
if: steps.release.conclusion == 'skipped'
shell: bash
run: |
if ! grep -qP '^(ci|db|deps|doc|env|feat|fix|fmt|merge|refactor|repo|revert|style|test|tweak)(\(\w+\))?:\s' <<< "$PR_TITLE"; then
echo "::warning::PR title Conventional Type is not on the list; refer to CONTRIBUTING.md"
exit 1
fi
- name: Check for Linear card number for feature branches
if: steps.release.conclusion == 'skipped' && startsWith(github.event.pull_request.title, 'feat')
shell: bash
run: |
if ! grep -qP '^\w+(\(\w+\))?:\s[A-Z]+-[0-9]+(:\s+\w+)?' <<< "$PR_TITLE"; then
echo "::warning::PR title should start with ticket number, e.g. 'feat(scope): ABC-123: ...'"
exit 1
fi