Skip to content

Commit 97ca4ed

Browse files
authored
Fix: [AEA-0000] - Add semantic release (#6)
* add semantic release * update name * use devDependencies
1 parent 8966a23 commit 97ca4ed

16 files changed

+7527
-20
lines changed

.devcontainer/Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ RUN git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.11.3 && \
3434
echo '. $HOME/.asdf/asdf.sh' >> ~/.bashrc && \
3535
echo '. $HOME/.asdf/completions/asdf.bash' >> ~/.bashrc
3636

37-
ENV PATH="$PATH:/home/vscode/.asdf/bin/:/workspaces/eps-prescription-tracker-ui/node_modules/.bin:/workspaces/eps-workflow-quality-checks/.venv/bin"
37+
ENV PATH="$PATH:/home/vscode/.asdf/bin/:/workspaces/eps-prescription-tracker-ui/node_modules/.bin:/workspaces/eps-common-workflows/.venv/bin"
3838

3939
# Install ASDF plugins#
4040
RUN asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git && \
@@ -43,9 +43,9 @@ RUN asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git && \
4343
asdf plugin add poetry https://github.com/asdf-community/asdf-poetry.git && \
4444
asdf plugin add python
4545

46-
WORKDIR /workspaces/eps-workflow-quality-checks
46+
WORKDIR /workspaces/eps-common-workflows
4747

48-
ADD .tool-versions /workspaces/eps-workflow-quality-checks/.tool-versions
48+
ADD .tool-versions /workspaces/eps-common-workflows/.tool-versions
4949
ADD .tool-versions /home/vscode/.tool-versions
5050

5151
RUN asdf install python && \

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
],
1919
"containerUser": "vscode",
2020
"remoteEnv": { "LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}" },
21-
"postAttachCommand": "docker build -f /workspaces/eps-workflow-quality-checks/dockerfiles/nhsd-git-secrets.dockerfile -t git-secrets . && pre-commit install --install-hooks -f",
21+
"postAttachCommand": "docker build -f /workspaces/eps-common-workflows/dockerfiles/nhsd-git-secrets.dockerfile -t git-secrets . && pre-commit install --install-hooks -f",
2222
"features": {
2323
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {
2424
"version": "latest",

.github/workflows/combine-dependabot-prs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
- name: Checkout repository
4848
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
4949
with:
50-
repository: NHSDigital/eps-workflow-dependabot
50+
repository: NHSDigital/eps-common-workflows
5151
sparse-checkout-cone-mode: false
5252
sparse-checkout: |
5353
combine-prs.js
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: PR Title Check
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
pr_title_format_check:
8+
runs-on: ubuntu-22.04
9+
permissions:
10+
pull-requests: write
11+
steps:
12+
- name: Check PR Title is Prefixed with Change Type
13+
id: check_prefix
14+
continue-on-error: true
15+
env:
16+
PR_TITLE: ${{ github.event.pull_request.title }}
17+
run: |
18+
if [[ "$PR_TITLE" =~ ^(Fix|Update|New|Breaking|Docs|Build|Upgrade|Chore):.*$ ]]; then
19+
echo "PR title is prefixed with change type."
20+
else
21+
echo "PR title is not prefixed with change type."
22+
exit 1
23+
fi
24+
25+
- name: Check PR Title contains Ticket/Dependabot Reference
26+
id: check_ticket_reference
27+
continue-on-error: true
28+
env:
29+
PR_TITLE: ${{ github.event.pull_request.title }}
30+
run: |
31+
if [[ "$PR_TITLE" =~ ^.*:.*\[([A-Z]+-[0-9]+|dependabot)\].*-.*$ ]]; then
32+
echo "PR title contains ticket or dependabot reference."
33+
else
34+
echo "PR title does not contain ticket or dependabot reference."
35+
exit 1
36+
fi
37+
38+
- name: Extract Ticket Reference
39+
id: extract_ticket_reference
40+
if: steps.check_ticket_reference.outcome == 'success'
41+
env:
42+
PR_TITLE: ${{ github.event.pull_request.title }}
43+
run: |
44+
if [[ "$PR_TITLE" =~ ^.*:.*\[([A-Z]+-[0-9]+|dependabot)\].*-.*$ ]]; then
45+
TICKET_REF="${BASH_REMATCH[1]}"
46+
echo "Extracted ticket reference: $TICKET_REF"
47+
echo "TICKET_REF=$TICKET_REF" > "$GITHUB_OUTPUT"
48+
else
49+
echo "No ticket reference found."
50+
exit 1
51+
fi
52+
53+
- name: Comment on PR with Jira Link
54+
if: steps.extract_ticket_reference.outcome == 'success' && steps.extract_ticket_reference.outputs.TICKET_REF != 'dependabot'
55+
uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b
56+
env:
57+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58+
TICKET_REF: ${{ steps.extract_ticket_reference.outputs.TICKET_REF }}
59+
with:
60+
message: |
61+
This PR is linked to a ticket in an NHS Digital JIRA Project. Here's a handy link to the ticket:
62+
# [${{ env.TICKET_REF }}](https://nhsd-jira.digital.nhs.uk/browse/${{ env.TICKET_REF }})
63+
comment-tag: pr-link
64+
65+
- name: Comment on PR for dependabot
66+
if: steps.extract_ticket_reference.outcome == 'success' && steps.extract_ticket_reference.outputs.TICKET_REF == 'dependabot'
67+
uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b
68+
env:
69+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70+
with:
71+
message: |
72+
This PR is raised by Dependabot to update a dependency.
73+
comment-tag: pr-link
74+
75+
- name: Comment on PR for bad format
76+
if: steps.check_prefix.outcome != 'success' || steps.check_ticket_reference.outcome != 'success'
77+
uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b
78+
env:
79+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
80+
with:
81+
message: |
82+
The PR title does not conform to the required format.
83+
Please ensure your PR title is prefixed with a change type (Fix, Update, New, Breaking, Docs, Build, Upgrade, Chore)
84+
and contains a ticket reference (eg. 'Fix: [AEA-####] - ...', or 'Chore: [dependabot] - ...'),
85+
then push an empty commit or recreate your PR.
86+
See the contributing guide for more details:
87+
https://github.com/NHSDigital/eps-common-workflows/blob/main/CONTRIBUTING.md
88+
comment-tag: pr-link

.github/workflows/pull_request.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
AUTOMERGE_APP_ID: ${{ secrets.AUTOMERGE_APP_ID }}
1616
AUTOMERGE_PEM: ${{ secrets.AUTOMERGE_PEM }}
1717
pr_title_format_check:
18-
uses: NHSDigital/eps-workflow-semantic-release/.github/workflows/pr_title_check.yml@f3d071da30cd01dc0e4472ac0e2d7452db78d1c7
18+
uses: ./.github/workflows/pr_title_check.yml
1919
get_asdf_version:
2020
runs-on: ubuntu-22.04
2121
outputs:
@@ -42,7 +42,7 @@ jobs:
4242
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
4343
tag_release:
4444
needs: [quality_checks, get_asdf_version]
45-
uses: NHSDigital/eps-workflow-semantic-release/.github/workflows/tag-release.yml@f3d071da30cd01dc0e4472ac0e2d7452db78d1c7
45+
uses: ./.github/workflows/tag-release.yml
4646
with:
4747
dry_run: true
4848
asdfVersion: ${{ needs.get_asdf_version.outputs.asdf_version }}

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
3535
tag_release:
3636
needs: [quality_checks, get_asdf_version]
37-
uses: NHSDigital/eps-workflow-semantic-release/.github/workflows/tag-release.yml@f3d071da30cd01dc0e4472ac0e2d7452db78d1c7
37+
uses: ./.github/workflows/tag-release.yml
3838
with:
3939
dry_run: false
4040
asdfVersion: ${{ needs.get_asdf_version.outputs.asdf_version }}

0 commit comments

Comments
 (0)