File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -123,8 +123,18 @@ get_workflow_runs() {
123123
124124 echo " Getting workflow runs using query: ${query} " >&2
125125
126- api " workflows/${INPUT_WORKFLOW_FILE_NAME} /runs?${query} " |
127- jq -r ' .workflow_runs[].id' |
126+ response=$( api " workflows/${INPUT_WORKFLOW_FILE_NAME} /runs?${query} " )
127+
128+ # Validate response is valid JSON with workflow_runs array
129+ if ! echo " $response " | jq -e ' .workflow_runs' > /dev/null 2>&1 ; then
130+ echo " Error: Invalid API response or missing workflow_runs" >&2
131+ echo " Response: $response " >&2
132+ return 1
133+ fi
134+
135+ echo " $response " |
136+ jq -r ' .workflow_runs[].id | select(. != null) | tostring' |
137+ grep -E ' ^[0-9]+$' |
128138 sort # Sort to ensure repeatable order, and lexicographically for compatibility with join
129139}
130140
You can’t perform that action at this time.
0 commit comments