|
1 | | -name: Trigger Notify Internal Infrastructure Deployment |
| 1 | +name: Call Notify Internal Infrastructure Deployment |
2 | 2 | ## Sub workflow which plans and deploys Notify components as part of the workflow. |
3 | 3 | ## Review Gates may be required to proceed on triggered builds. |
4 | 4 |
|
|
9 | 9 | type: string |
10 | 10 | description: The Github release version, commit, or tag. |
11 | 11 | default: main |
| 12 | + target_workflow: |
| 13 | + type: string |
| 14 | + description: The name of the github workflow to call. |
| 15 | + default: main |
12 | 16 | tf_environment: |
13 | 17 | type: string |
14 | 18 | description: The Terraform environment to deploy |
@@ -44,18 +48,15 @@ jobs: |
44 | 48 | shell: bash |
45 | 49 | run: | |
46 | 50 | set -x |
47 | | - this_repo_name=$(echo ${{ github.repository }} | cut -d'/' -f2) |
48 | 51 |
|
49 | 52 | DISPATCH_EVENT=$(jq -ncM \ |
50 | | - --arg infraRepoName "${this_repo_name}" \ |
51 | 53 | --arg releaseVersion ${{ inputs.release_version }} \ |
52 | 54 | --arg targetEnvironment ${{ inputs.tf_environment }} \ |
53 | 55 | --arg targetAccountGroup ${{ inputs.tf_group }} \ |
54 | 56 | --arg targetComponent ${{ inputs.tf_component }} \ |
55 | 57 | --arg terraformAction ${{ inputs.tf_action }} \ |
56 | 58 | '{ "ref": "main", |
57 | 59 | "inputs": { |
58 | | - "infraRepoName": $infraRepoName, |
59 | 60 | "releaseVersion", $releaseVersion, |
60 | 61 | "targetEnvironment", $targetEnvironment, |
61 | 62 | "targetAccountGroup", $targetAccountGroup, |
|
72 | 73 | -H "Accept: application/vnd.github+json" \ |
73 | 74 | -H "Authorization: Bearer ${{ secrets.PR_TRIGGER_PAT }}" \ |
74 | 75 | -H "X-GitHub-Api-Version: 2022-11-28" \ |
75 | | - https://api.github.com/repos/NHSDigital/nhs-notify-internal/actions/workflows/dispatch-deploy-static-env.yaml/dispatches \ |
| 76 | + "https://api.github.com/repos/NHSDigital/nhs-notify-internal/actions/workflows/${{ inputs.target_workflow }}/dispatches" \ |
76 | 77 | -d "${DISPATCH_EVENT}" |
77 | 78 |
|
78 | 79 | echo "Workflow triggered successfully. HTTP response. Waiting for the workflow to complete.." |
|
0 commit comments