Skip to content

Commit 516906d

Browse files
authored
Remove branch name check on PRs in favour of a check on the title
IMO there is no value in requiring branch names to be in a certain format, and just causes people to have to redo work, like would be done here if not for this change
1 parent 06caf33 commit 516906d

File tree

1 file changed

+8
-18
lines changed

1 file changed

+8
-18
lines changed

.github/workflows/pr-lint.yaml

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,14 @@
11
name: PR Quality Check
2-
on: pull_request
2+
on:
3+
pull_request:
4+
types: [opened, synchronize, edited, reopened]
35
jobs:
46
link-ticket:
57
runs-on: ubuntu-latest
68
steps:
7-
- name: Check ticket name conforms to requirements
8-
run: echo ${{ github.event.pull_request.head.ref }} | grep -i -E -q "((apm|niad|amb|flagsapi)-[0-9]+)|(dependabot\/)"
9-
10-
- name: Grab ticket name
11-
if: contains(github.event.pull_request.head.ref, 'apm-') || contains(github.event.pull_request.head.ref, 'APM-') || contains(github.event.pull_request.head.ref, 'niad-') || contains(github.event.pull_request.head.ref, 'NIAD-') || contains(github.event.pull_request.head.ref, 'amb-') || contains(github.event.pull_request.head.ref, 'AMB-')
12-
run: echo ::set-env name=TICKET_NAME::$(echo ${{ github.event.pull_request.head.ref }} | tr '[:lower:]' '[:upper:]' | grep -i -o '^\(APM\|NIAD\|AMB\)-[0-9]\+')
9+
- name: Check PR title starts with Jira reference
1310
env:
14-
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
15-
16-
- name: Comment on PR
17-
if: contains(github.event.pull_request.head.ref, 'apm-') || contains(github.event.pull_request.head.ref, 'APM-') || contains(github.event.pull_request.head.ref, 'niad-') || contains(github.event.pull_request.head.ref, 'NIAD-') || contains(github.event.pull_request.head.ref, 'amb-') || contains(github.event.pull_request.head.ref, 'AMB-')
18-
uses: unsplash/comment-on-pr@master
19-
env:
20-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21-
with:
22-
msg: |
23-
This branch is work on a ticket in the NHS Digital APM JIRA Project. Here's a handy link to the ticket:
24-
# [${{ env.TICKET_NAME }}](https://nhsd-jira.digital.nhs.uk/browse/${{ env.TICKET_NAME}})
11+
PR_TITLE: ${{ github.event.pull_request.title }}
12+
run: |
13+
JIRA_REGEX="^(APM|NIAD|AMB|FLAGSAPI)-([[:digit:]]+)"
14+
[[ "$PR_TITLE" =~ $JIRA_REGEX ]] && exit 0 || exit 1

0 commit comments

Comments
 (0)