Skip to content

Commit 6db1ccb

Browse files
CCM-11942 Updating script with debug info
1 parent 314fb5d commit 6db1ccb

File tree

1 file changed

+21
-26
lines changed

1 file changed

+21
-26
lines changed

.github/scripts/dispatch_internal_repo_workflow.sh

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -149,37 +149,32 @@ echo "[INFO] Workflow trigger request sent successfully, waiting for completion.
149149

150150
# Poll GitHub API to check the workflow status
151151
workflow_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-
176152
for _ 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

Comments
 (0)