-
Notifications
You must be signed in to change notification settings - Fork 2
34 lines (31 loc) · 1.33 KB
/
pr_title_check.yml
File metadata and controls
34 lines (31 loc) · 1.33 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
name: PR Title Check
on:
workflow_call:
jobs:
pr_title_format_check:
runs-on: ubuntu-22.04
steps:
- name: Check PR Title is Prefixed with Change Type
env:
PR_TITLE: ${{ github.event.pull_request.title }}
run: |
if [[ "$PR_TITLE" =~ ^(Fix|Update|New|Breaking|Docs|Build|Upgrade|Chore):.*$ ]]; then
echo "PR title is prefixed with change type."
else
echo "PR title is not prefixed with change type."
echo "Please prefix your PR title with a change type (Fix, Update, New, Breaking, Docs, Build, Upgrade, Chore)."
echo "See the contributing guide for more details:"
echo "https://github.com/NHSDigital/nhs-fhir-middy-error-handler/blob/main/CONTRIBUTING.md"
exit 1
fi
- name: Check PR Title contains Ticket/Dependabot Reference
env:
PR_TITLE: ${{ github.event.pull_request.title }}
run: |
if [[ "$PR_TITLE" =~ ^.*:.*\[([A-Z]+-[0-9]+|dependabot)\].*-.*$ ]]; then
echo "PR title contains ticket or dependabot reference."
else
echo "PR title does not contain ticket or dependabot reference."
echo "Please ensure PR title contains a ticket (eg. 'Fix: [AEA-####] - ...', or 'Chore: [dependabot] - ...')."
exit 1
fi