@@ -149,37 +149,32 @@ echo "[INFO] Workflow trigger request sent successfully, waiting for completion.
149149
150150# Poll GitHub API to check the workflow status
151151workflow_run_url=" "
152-
153- WORKFLOW_RUN_EVENT=$( jq -r \
154- --arg callerRunId " $callerRunId " \
155- --arg targetWorkflow " $targetWorkflow " \
156- --arg targetEnvironment " $targetEnvironment " \
157- --arg targetAccountGroup " $targetAccountGroup " \
158- --arg targetComponent " $targetComponent " \
159- --arg terraformAction " $terraformAction " \
160- ' .workflow_runs[]
161- | select(.path == ".github/workflows/" + $targetWorkflow)
162- | select(.name
163- | contains($targetEnvironment)
164- and contains($targetAccountGroup)
165- and contains($targetComponent)
166- and contains($terraformAction)
167- )
168- | if ($targetWorkflow | test("dispatch-(acceptance|contextual|product|security)-tests-.*\\.yaml"))
169- then select(.name | contains("caller:" + $callerRunId))
170- else .
171- end
172- | .url' )
173-
174- echo " [INFO] Checking for workflow run $WORKFLOW_RUN_EVENT "
175-
176152for _ in {1..18}; do
177- workflow_run_url=$( curl -s -L \
153+ workflow_run_url=$( curl -s -L \
178154 -H " Accept: application/vnd.github+json" \
179155 -H " Authorization: Bearer ${PR_TRIGGER_PAT} " \
180156 -H " X-GitHub-Api-Version: 2022-11-28" \
181157 " https://api.github.com/repos/NHSDigital/nhs-notify-internal/actions/runs?event=workflow_dispatch" \
182- -d " $WORKFLOW_RUN_EVENT " 2>&1 )
158+ | jq -r \
159+ --arg callerRunId " $callerRunId " \
160+ --arg targetWorkflow " $targetWorkflow " \
161+ --arg targetEnvironment " $targetEnvironment " \
162+ --arg targetAccountGroup " $targetAccountGroup " \
163+ --arg targetComponent " $targetComponent " \
164+ --arg terraformAction " $terraformAction " \
165+ ' .workflow_runs[]
166+ | select(.path == ".github/workflows/" + $targetWorkflow)
167+ | select(.name
168+ | contains($targetEnvironment)
169+ and contains($targetAccountGroup)
170+ and contains($targetComponent)
171+ and contains($terraformAction)
172+ )
173+ | if ($targetWorkflow | test("dispatch-(acceptance|contextual|product|security)-tests-.*\\.yaml"))
174+ then select(.name | contains("caller:" + $callerRunId))
175+ else .
176+ end
177+ | .url' )
183178
184179 if [[ -n " $workflow_run_url " && " $workflow_run_url " != null ]]; then
185180 ui_url=${workflow_run_url/ api./ }
0 commit comments