Skip to content

Commit 474083b

Browse files
committed
Temporarily log error
1 parent 2ab6857 commit 474083b

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

.github/scripts/dispatch_internal_repo_workflow.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -285,16 +285,21 @@ echo "[INFO] Triggering workflow '$targetWorkflow' in nhs-notify-internal..."
285285
echo "[DEBUG] Dispatch event payload: $DISPATCH_EVENT"
286286

287287
trigger_response=$(curl -s -L \
288-
--fail \
289288
-X POST \
290289
-H "Accept: application/vnd.github+json" \
291290
-H "Authorization: Bearer ${PR_TRIGGER_PAT}" \
292291
-H "X-GitHub-Api-Version: 2022-11-28" \
293292
"https://api.github.com/repos/NHSDigital/nhs-notify-internal/actions/workflows/$targetWorkflow/dispatches" \
294293
-d "$DISPATCH_EVENT" 2>&1)
295294

296-
if [[ $? -ne 0 ]]; then
297-
echo "[ERROR] Failed to trigger workflow. Response: $trigger_response"
295+
http_status=$(echo "$trigger_response" | grep "HTTP_STATUS:" | cut -d: -f2)
296+
body=$(echo "$trigger_response" | grep -v "HTTP_STATUS:")
297+
298+
echo "[DEBUG] HTTP status: $http_status"
299+
echo "[DEBUG] Response body: $body"
300+
301+
if [[ "$http_status" -lt 200 || "$http_status" -ge 300 ]]; then
302+
echo "[ERROR] Failed to trigger workflow. HTTP $http_status. Response: $body"
298303
exit 1
299304
fi
300305

0 commit comments

Comments
 (0)