Skip to content

Commit 4493f88

Browse files
CCM-9979: Prevent deploy selecting wrong internal repo (#498)
1 parent 488c8aa commit 4493f88

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

.github/workflows/reusable_internal_repo_build.yaml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,20 @@ jobs:
8181
# Poll GitHub API to check the workflow status
8282
run_id=""
8383
for i in {1..12}; do
84-
run_id=$(curl -s \
84+
in_progress=$(curl -s \
8585
-H "Accept: application/vnd.github+json" \
8686
-H "Authorization: Bearer ${{ secrets.PR_TRIGGER_PAT }}" \
8787
-H "X-GitHub-Api-Version: 2022-11-28" \
88-
"https://api.github.com/repos/NHSDigital/nhs-notify-internal/actions/runs?event=workflow_dispatch&status=in_progress" \
89-
| jq -r '.workflow_runs[0].id')
88+
"https://api.github.com/repos/NHSDigital/nhs-notify-internal/actions/runs?event=workflow_dispatch&status=in_progress")
89+
90+
run_id=$(echo "$in_progress" | jq -r \
91+
--arg env "${{ inputs.targetEnvironment }}" \
92+
--arg component "${{ inputs.targetComponent }}" \
93+
--arg repoName "nhs-notify-web-template-management" \
94+
--arg releaseVersion "${{ inputs.releaseVersion }}" \
95+
'.workflow_runs[]
96+
| select(.name | contains($env) and contains($component) and contains($repoName) and contains($releaseVersion))
97+
| .id' | head -n 1)
9098
9199
if [[ -n "$run_id" && "$run_id" != null ]]; then
92100
echo "Found workflow run with ID: $run_id"

0 commit comments

Comments
 (0)