Skip to content

Commit 4dabde2

Browse files
CCM-8071 destroy env fixes
1 parent a65fa99 commit 4dabde2

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: PR Destroy Environment
2+
3+
on:
4+
pull_request:
5+
types: [closed]
6+
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.ref }}
9+
cancel-in-progress: false
10+
11+
jobs:
12+
create-dynamic-environment:
13+
name: Destroy Dynamic Environment
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Trigger nhs-notify-internal dynamic environment destruction
18+
shell: bash
19+
run: |
20+
set -x
21+
this_repo_name=$(echo ${{ github.repository }} | cut -d'/' -f2)
22+
23+
DISPATCH_EVENT=$(jq -ncM \
24+
--arg infraRepoName "${this_repo_name}" \
25+
--arg releaseVersion "main" \
26+
--arg targetEnvironment "pr${{ github.event.number }}" \
27+
--arg targetAccountGroup "nhs-notify-template-management-dev" \
28+
--arg targetComponent "branch" \
29+
--arg terraformAction "destroy" \
30+
'{ "ref": "main",
31+
"inputs": {
32+
"infraRepoName": $infraRepoName,
33+
"releaseVersion", $releaseVersion,
34+
"targetEnvironment", $targetEnvironment,
35+
"targetAccountGroup", $targetAccountGroup,
36+
"targetComponent", $targetComponent,
37+
"terraformAction", $terraformAction,
38+
"overrides", $overrides,
39+
}
40+
}')
41+
42+
curl --fail -L \
43+
-X POST \
44+
-H "Accept: application/vnd.github+json" \
45+
-H "Authorization: Bearer ${{ secrets.PR_TRIGGER_PAT }}" \
46+
-H "X-GitHub-Api-Version: 2022-11-28" \
47+
https://api.github.com/repos/NHSDigital/nhs-notify-internal/actions/workflows/dispatch-deploy-dynamic-env.yaml/dispatches \
48+
-d "${DISPATCH_EVENT}"

0 commit comments

Comments
 (0)