Skip to content

Commit c0cc50f

Browse files
authored
Build: [AEA-4506] - Move to communal QC. Fix pr link (#221)
## Summary - 🤖 Operational or Infrastructure Change ### Details Replace the `quality-checks.yml` file in the repo with the communal one shared across all EPS projects
1 parent 851f87a commit c0cc50f

File tree

6 files changed

+24
-81
lines changed

6 files changed

+24
-81
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ on:
66

77
jobs:
88
quality_checks:
9-
uses: ./.github/workflows/quality_checks.yml
10-
with:
11-
BRANCH_NAME: main
9+
uses: NHSDigital/eps-workflow-quality-checks/.github/workflows/[email protected]
1210
secrets:
1311
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
1412

.github/workflows/pr_link.yml

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: PR Link ticket
2-
on:
2+
on:
33
pull_request:
44
types: [opened]
55
jobs:
@@ -14,10 +14,25 @@ jobs:
1414

1515
- name: Grab ticket name
1616
if: contains(github.event.pull_request.head.ref, 'aea-') || contains(github.event.pull_request.head.ref, 'AEA-') || contains(github.event.pull_request.head.ref, 'apm-') || contains(github.event.pull_request.head.ref, 'APM-') || contains(github.event.pull_request.head.ref, 'apmspii-') || contains(github.event.pull_request.head.ref, 'APMSPII-') || contains(github.event.pull_request.head.ref, 'adz-') || contains(github.event.pull_request.head.ref, 'ADZ-') || contains(github.event.pull_request.head.ref, 'amb-') || contains(github.event.pull_request.head.ref, 'AMB-')
17-
run: echo name=TICKET_NAME::"$(echo "$REF" | grep -i -o '\(aea-[0-9]\+\)\|\(apm-[0-9]\+\)\|\(apmspii-[0-9]\+\)\|\(adz-[0-9]\+\)|\(amb-[0-9]\+\)' | tr '[:lower:]' '[:upper:]')" >> "$GITHUB_ENV"
1817
continue-on-error: true
19-
env:
20-
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
18+
run: |
19+
# Match ticket name patterns
20+
REGEX='
21+
(aea-[0-9]+)|
22+
(apm-[0-9]+)|
23+
(apmspii-[0-9]+)|
24+
(adz-[0-9]+)|
25+
(amb-[0-9]+)
26+
'
27+
28+
# Remove whitespace and newlines from the regex
29+
REGEX=$(echo "$REGEX" | tr -d '[:space:]')
30+
31+
# Extract the ticket name and convert to uppercase
32+
TICKET_NAME=$(echo "$REF" | grep -i -E -o "$REGEX" | tr '[:lower:]' '[:upper:]')
33+
34+
# Set the environment variable
35+
echo "TICKET_NAME=$TICKET_NAME" >> "$GITHUB_ENV"
2136
2237
- name: Comment on PR with link to JIRA ticket
2338
if: contains(github.event.pull_request.head.ref, 'aea-') || contains(github.event.pull_request.head.ref, 'AEA-') || contains(github.event.pull_request.head.ref, 'apm-') || contains(github.event.pull_request.head.ref, 'APM-') || contains(github.event.pull_request.head.ref, 'apmspii-') || contains(github.event.pull_request.head.ref, 'APMSPII-') || contains(github.event.pull_request.head.ref, 'adz-') || contains(github.event.pull_request.head.ref, 'ADZ-') || contains(github.event.pull_request.head.ref, 'amb-') || contains(github.event.pull_request.head.ref, 'AMB-')
@@ -27,5 +42,5 @@ jobs:
2742
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2843
with:
2944
msg: |
30-
This branch is work on a ticket in the NHS Digital APM JIRA Project. Here's a handy link to the ticket:
45+
This branch is work on a ticket in an NHS Digital JIRA Project. Here's a handy link to the ticket:
3146
# [${{ env.TICKET_NAME }}](https://nhsd-jira.digital.nhs.uk/browse/${{ env.TICKET_NAME }})

.github/workflows/pull_request.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ on:
66

77
jobs:
88
quality_checks:
9-
uses: ./.github/workflows/quality_checks.yml
10-
with:
11-
BRANCH_NAME: ${{ github.event.pull_request.head.ref }}
9+
uses: NHSDigital/eps-workflow-quality-checks/.github/workflows/[email protected]
1210
secrets:
1311
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
1412

.github/workflows/quality_checks.yml

Lines changed: 0 additions & 65 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ on:
77

88
jobs:
99
quality_checks:
10-
uses: ./.github/workflows/quality_checks.yml
11-
with:
12-
BRANCH_NAME: main
10+
uses: NHSDigital/eps-workflow-quality-checks/.github/workflows/[email protected]
1311
secrets:
1412
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
1513

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,7 @@ Workflows are in the .github/workflows folder
143143
- `dependabot_auto_approve_and_merge.yml`: Workflow to auto merge dependabot updates
144144
- `pr_link.yml`: Workflow to link Pull Requests to Jira tickets and runs when a pull request is opened.
145145
- `pr_title_check.yml`: Workflow to check the format of a pull request is compliant with the project standards. See [guidelines for contribution](./CONTRIBUTING.md) for details.
146-
- `pull_request.yml`: Called when pull request is opened or updated. Runs rename_dependabot_prs.yml, quality_checks.yml, and pr_title_check.yml
147-
- `quality_checks.yml`: Runs quality checks on code. Runs on demand.
146+
- `pull_request.yml`: Called when pull request is opened or updated. Runs rename_dependabot_prs.yml, [quality_checks](https://github.com/NHSDigital/eps-workflow-quality-checks), and pr_title_check.yml
148147
- `release.yml`: Uses [semantic-release](https://semantic-release.gitbook.io/semantic-release/) to release main branch to [NPM](https://www.npmjs.com/package/@nhs/fhir-middy-error-handler).
149148
- `rename_dependabot_prs.yml`: Renames dependabot pull requests to comply with project standards.
150149

0 commit comments

Comments
 (0)