File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -285,16 +285,21 @@ echo "[INFO] Triggering workflow '$targetWorkflow' in nhs-notify-internal..."
285285echo " [DEBUG] Dispatch event payload: $DISPATCH_EVENT "
286286
287287trigger_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
299304fi
300305
You can’t perform that action at this time.
0 commit comments