Skip to content

Commit

Permalink
Build: [AEA-4506] - Move to communal QC. Fix pr link (#221)
Browse files Browse the repository at this point in the history
## Summary

- 🤖 Operational or Infrastructure Change

### Details

Replace the `quality-checks.yml` file in the repo with the communal one
shared across all EPS projects
  • Loading branch information
wildjames authored Oct 22, 2024
1 parent 851f87a commit c0cc50f
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 81 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ on:

jobs:
quality_checks:
uses: ./.github/workflows/quality_checks.yml
with:
BRANCH_NAME: main
uses: NHSDigital/eps-workflow-quality-checks/.github/workflows/[email protected]
secrets:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

Expand Down
25 changes: 20 additions & 5 deletions .github/workflows/pr_link.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: PR Link ticket
on:
on:
pull_request:
types: [opened]
jobs:
Expand All @@ -14,10 +14,25 @@ jobs:

- name: Grab ticket name
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-')
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"
continue-on-error: true
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
run: |
# Match ticket name patterns
REGEX='
(aea-[0-9]+)|
(apm-[0-9]+)|
(apmspii-[0-9]+)|
(adz-[0-9]+)|
(amb-[0-9]+)
'
# Remove whitespace and newlines from the regex
REGEX=$(echo "$REGEX" | tr -d '[:space:]')
# Extract the ticket name and convert to uppercase
TICKET_NAME=$(echo "$REF" | grep -i -E -o "$REGEX" | tr '[:lower:]' '[:upper:]')
# Set the environment variable
echo "TICKET_NAME=$TICKET_NAME" >> "$GITHUB_ENV"
- name: Comment on PR with link to JIRA ticket
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-')
Expand All @@ -27,5 +42,5 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
msg: |
This branch is work on a ticket in the NHS Digital APM JIRA Project. Here's a handy link to the ticket:
This branch is work on a ticket in an NHS Digital JIRA Project. Here's a handy link to the ticket:
# [${{ env.TICKET_NAME }}](https://nhsd-jira.digital.nhs.uk/browse/${{ env.TICKET_NAME }})
4 changes: 1 addition & 3 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ on:

jobs:
quality_checks:
uses: ./.github/workflows/quality_checks.yml
with:
BRANCH_NAME: ${{ github.event.pull_request.head.ref }}
uses: NHSDigital/eps-workflow-quality-checks/.github/workflows/[email protected]
secrets:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

Expand Down
65 changes: 0 additions & 65 deletions .github/workflows/quality_checks.yml

This file was deleted.

4 changes: 1 addition & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ on:

jobs:
quality_checks:
uses: ./.github/workflows/quality_checks.yml
with:
BRANCH_NAME: main
uses: NHSDigital/eps-workflow-quality-checks/.github/workflows/[email protected]
secrets:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,7 @@ Workflows are in the .github/workflows folder
- `dependabot_auto_approve_and_merge.yml`: Workflow to auto merge dependabot updates
- `pr_link.yml`: Workflow to link Pull Requests to Jira tickets and runs when a pull request is opened.
- `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.
- `pull_request.yml`: Called when pull request is opened or updated. Runs rename_dependabot_prs.yml, quality_checks.yml, and pr_title_check.yml
- `quality_checks.yml`: Runs quality checks on code. Runs on demand.
- `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
- `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).
- `rename_dependabot_prs.yml`: Renames dependabot pull requests to comply with project standards.

Expand Down

0 comments on commit c0cc50f

Please sign in to comment.