Skip to content

Commit fd4b219

Browse files
committed
create action
1 parent d0f60be commit fd4b219

7 files changed

Lines changed: 265 additions & 2 deletions

File tree

.devcontainer/Dockerfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
ARG IMAGE_NAME=node_24_python_3_14
2+
ARG IMAGE_VERSION=latest
3+
FROM ghcr.io/nhsdigital/eps-devcontainers/${IMAGE_NAME}:${IMAGE_VERSION}
4+
5+
USER root
6+
# specify DOCKER_GID to force container docker group id to match host
7+
RUN if [ -n "${DOCKER_GID}" ]; then \
8+
if ! getent group docker; then \
9+
groupadd -g ${DOCKER_GID} docker; \
10+
else \
11+
groupmod -g ${DOCKER_GID} docker; \
12+
fi && \
13+
usermod -aG docker vscode; \
14+
fi

.devcontainer/devcontainer.json

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"name": "eps-copilot-instructions",
3+
"build": {
4+
"dockerfile": "Dockerfile",
5+
"context": "..",
6+
"args": {
7+
"DOCKER_GID": "${env:DOCKER_GID:}",
8+
"IMAGE_NAME": "node_24_python_3_14",
9+
"IMAGE_VERSION": "v1.2.0",
10+
"USER_UID": "${localEnv:USER_ID:}",
11+
"USER_GID": "${localEnv:GROUP_ID:}"
12+
},
13+
"updateRemoteUserUID": false
14+
},
15+
"postAttachCommand": "git-secrets --register-aws; git-secrets --add-provider -- cat /usr/share/secrets-scanner/nhsd-rules-deny.txt",
16+
"mounts": [
17+
"source=${env:HOME}${env:USERPROFILE}/.aws,target=/home/vscode/.aws,type=bind",
18+
"source=${env:HOME}${env:USERPROFILE}/.ssh,target=/home/vscode/.ssh,type=bind",
19+
"source=${env:HOME}${env:USERPROFILE}/.gnupg,target=/home/vscode/.gnupg,type=bind",
20+
"source=${env:HOME}${env:USERPROFILE}/.npmrc,target=/home/vscode/.npmrc,type=bind"
21+
],
22+
"containerUser": "vscode",
23+
"remoteEnv": {
24+
"LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}"
25+
},
26+
"features": {},
27+
"customizations": {
28+
"vscode": {
29+
"extensions": [
30+
"AmazonWebServices.aws-toolkit-vscode",
31+
"redhat.vscode-yaml",
32+
"eamodio.gitlens",
33+
"github.vscode-pull-request-github",
34+
"streetsidesoftware.code-spell-checker",
35+
"timonwong.shellcheck",
36+
"github.vscode-github-actions"
37+
],
38+
"settings": {
39+
"cSpell.words": [
40+
"fhir",
41+
"Formik",
42+
"pino",
43+
"serialisation"
44+
]
45+
}
46+
}
47+
}
48+
}

.github/workflows/ci.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: pull_request
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
7+
env:
8+
BRANCH_NAME: ${{ github.event.pull_request.head.ref }}
9+
10+
jobs:
11+
get_config_values:
12+
uses: NHSDigital/eps-common-workflows/.github/workflows/get-repo-config.yml@f3d19a678a725917a5c59cae4d76db621bb7c9c7
13+
with:
14+
verify_published_from_main_image: false
15+
16+
dependabot-auto-approve-and-merge:
17+
uses: NHSDigital/eps-common-workflows/.github/workflows/dependabot-auto-approve-and-merge.yml@f3d19a678a725917a5c59cae4d76db621bb7c9c7
18+
secrets:
19+
AUTOMERGE_APP_ID: ${{ secrets.AUTOMERGE_APP_ID }}
20+
AUTOMERGE_PEM: ${{ secrets.AUTOMERGE_PEM }}
21+
22+
quality_checks:
23+
uses: NHSDigital/eps-common-workflows/.github/workflows/quality-checks-devcontainer.yml@f3d19a678a725917a5c59cae4d76db621bb7c9c7
24+
needs: [get_config_values]
25+
with:
26+
pinned_image: ${{ needs.get_config_values.outputs.pinned_image }}
27+
secrets:
28+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
29+
30+
pr_title_format_check:
31+
uses: NHSDigital/eps-common-workflows/.github/workflows/pr_title_check.yml@f3d19a678a725917a5c59cae4d76db621bb7c9c7
32+
33+
tag_release:
34+
needs: [get_config_values]
35+
uses: NHSDigital/eps-common-workflows/.github/workflows/tag-release-devcontainer.yml@f3d19a678a725917a5c59cae4d76db621bb7c9c7
36+
permissions:
37+
id-token: "write"
38+
contents: "write"
39+
with:
40+
dry_run: true
41+
pinned_image: ${{ needs.get_config_values.outputs.pinned_image }}
42+
branch_name: ${{ github.event.pull_request.head.ref }}
43+
tag_format: ${{ needs.get_config_values.outputs.tag_format }}
44+
secrets: inherit

.github/workflows/pull_request.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: pull_request
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
7+
env:
8+
BRANCH_NAME: ${{ github.event.pull_request.head.ref }}
9+
10+
jobs:
11+
get_config_values:
12+
uses: NHSDigital/eps-common-workflows/.github/workflows/get-repo-config.yml@f3d19a678a725917a5c59cae4d76db621bb7c9c7
13+
with:
14+
verify_published_from_main_image: false
15+
16+
dependabot-auto-approve-and-merge:
17+
uses: NHSDigital/eps-common-workflows/.github/workflows/dependabot-auto-approve-and-merge.yml@f3d19a678a725917a5c59cae4d76db621bb7c9c7
18+
secrets:
19+
AUTOMERGE_APP_ID: ${{ secrets.AUTOMERGE_APP_ID }}
20+
AUTOMERGE_PEM: ${{ secrets.AUTOMERGE_PEM }}
21+
22+
quality_checks:
23+
uses: NHSDigital/eps-common-workflows/.github/workflows/quality-checks-devcontainer.yml@f3d19a678a725917a5c59cae4d76db621bb7c9c7
24+
needs: [get_config_values]
25+
with:
26+
pinned_image: ${{ needs.get_config_values.outputs.pinned_image }}
27+
secrets:
28+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
29+
30+
pr_title_format_check:
31+
uses: NHSDigital/eps-common-workflows/.github/workflows/pr_title_check.yml@f3d19a678a725917a5c59cae4d76db621bb7c9c7
32+
33+
tag_release:
34+
needs: [get_config_values]
35+
uses: NHSDigital/eps-common-workflows/.github/workflows/tag-release-devcontainer.yml@f3d19a678a725917a5c59cae4d76db621bb7c9c7
36+
permissions:
37+
id-token: "write"
38+
contents: "write"
39+
with:
40+
dry_run: true
41+
pinned_image: ${{ needs.get_config_values.outputs.pinned_image }}
42+
branch_name: ${{ github.event.pull_request.head.ref }}
43+
tag_format: ${{ needs.get_config_values.outputs.tag_format }}
44+
secrets: inherit

.github/workflows/release.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: pull_request
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
7+
env:
8+
BRANCH_NAME: ${{ github.event.pull_request.head.ref }}
9+
10+
jobs:
11+
get_config_values:
12+
uses: NHSDigital/eps-common-workflows/.github/workflows/get-repo-config.yml@f3d19a678a725917a5c59cae4d76db621bb7c9c7
13+
with:
14+
verify_published_from_main_image: false
15+
16+
dependabot-auto-approve-and-merge:
17+
uses: NHSDigital/eps-common-workflows/.github/workflows/dependabot-auto-approve-and-merge.yml@f3d19a678a725917a5c59cae4d76db621bb7c9c7
18+
secrets:
19+
AUTOMERGE_APP_ID: ${{ secrets.AUTOMERGE_APP_ID }}
20+
AUTOMERGE_PEM: ${{ secrets.AUTOMERGE_PEM }}
21+
22+
quality_checks:
23+
uses: NHSDigital/eps-common-workflows/.github/workflows/quality-checks-devcontainer.yml@f3d19a678a725917a5c59cae4d76db621bb7c9c7
24+
needs: [get_config_values]
25+
with:
26+
pinned_image: ${{ needs.get_config_values.outputs.pinned_image }}
27+
secrets:
28+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
29+
30+
pr_title_format_check:
31+
uses: NHSDigital/eps-common-workflows/.github/workflows/pr_title_check.yml@f3d19a678a725917a5c59cae4d76db621bb7c9c7
32+
33+
tag_release:
34+
needs: [get_config_values]
35+
uses: NHSDigital/eps-common-workflows/.github/workflows/tag-release-devcontainer.yml@f3d19a678a725917a5c59cae4d76db621bb7c9c7
36+
permissions:
37+
id-token: "write"
38+
contents: "write"
39+
with:
40+
dry_run: false
41+
pinned_image: ${{ needs.get_config_values.outputs.pinned_image }}
42+
branch_name: ${{ github.event.pull_request.head.ref }}
43+
tag_format: ${{ needs.get_config_values.outputs.tag_format }}
44+
secrets: inherit

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# EPS Copilot Instructions
22

3-
This project contains copilot instruction files that can be copied to each EPS repo as an initial instructions.
3+
This project contains copilot instruction files that are copied to each EPS repo as an initial instructions.
44

5-
It also contains language specific instruction files that are kept in sync in each EPS project using git submodules
5+
It also contains an action that are used to cepy the files to each repo

action.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Sync Copilot Instructions
2+
description: "Syncs Copilot instructions from the repository to the GitHub Action's metadata file."
3+
inputs:
4+
common_workflows_ref:
5+
description: "The ref to sync from the central repository"
6+
required: false
7+
default: "main"
8+
type: string
9+
calling_repo_base_branch:
10+
description: "The base branch from the calling repository that should be merged into"
11+
required: false
12+
type: string
13+
default: main
14+
runs:
15+
using: "composite"
16+
steps:
17+
- name: Checkout calling repo code
18+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
19+
with:
20+
ref: ${{ inputs.calling_repo_base_branch }}
21+
fetch-depth: 0
22+
23+
- name: Checkout central repo code
24+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
25+
with:
26+
ref: ${{ inputs.common_workflows_ref }}
27+
fetch-depth: 0
28+
path: eps-common-workflows
29+
repository: NHSDigital/eps-common-workflows
30+
sparse-checkout: |
31+
.github/instructions/general
32+
.github/instructions/languages
33+
.github/copilot-instructions.md
34+
.github/prompts
35+
36+
- name: Copy central instructions
37+
run: |
38+
rm -rf .github/instructions/general
39+
rm -rf .github/instructions/languages
40+
rm -rf .github/copilot-instructions.md
41+
rm -rf .github/prompts
42+
mkdir -p .github/instructions/
43+
cp -R eps-common-workflows/.github/instructions/general .github/instructions/general
44+
cp -R eps-common-workflows/.github/instructions/languages .github/instructions/languages
45+
cp eps-common-workflows/.github/copilot-instructions.md .github/copilot-instructions.md
46+
cp -R eps-common-workflows/.github/prompts .github/prompts
47+
rm -rf eps-common-workflows
48+
49+
- name: Create GitHub App Token
50+
uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859
51+
id: generate-token
52+
with:
53+
app-id: "${{ secrets.CREATE_PULL_REQUEST_APP_ID }}"
54+
private-key: "${{ secrets.CREATE_PULL_REQUEST_PEM }}"
55+
56+
- name: Create Pull Request
57+
uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0
58+
with:
59+
token: "${{ steps.generate-token.outputs.token }}"
60+
commit-message: "Upgrade: [dependabot] - sync Copilot instructions"
61+
title: "Upgrade: [dependabot] - sync Copilot instructions"
62+
body: |
63+
Syncing Copilot instructions from central repo.
64+
Ref: `${{ inputs.common_workflows_ref }}`
65+
branch: copilot-instructions-sync
66+
base: ${{ inputs.calling_repo_base_branch }}
67+
branch-suffix: random
68+
sign-commits: true
69+
delete-branch: true

0 commit comments

Comments
 (0)