Skip to content

Commit e42b4a2

Browse files
Merge branch 'master' into FLAGSAPI-1360-alerts-additional-information
2 parents 570b7e7 + 8157d36 commit e42b4a2

2 files changed

Lines changed: 108 additions & 119 deletions

File tree

.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)