Skip to content

Commit 15b4524

Browse files
added safer pattern for gh api
1 parent 66c7dfb commit 15b4524

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

.github/workflows/regression-summary.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,14 @@ jobs:
6666
6767
echo "Scanning branch $BRANCH from $SINCE to $UNTIL" >&2
6868
69-
# Get runs (paginated, only up to 100 runs per API call, modify as needed for deeper history)
70-
RUNS=$(gh api "/repos/${TARGET_REPO}/actions/runs?branch=${BRANCH}&status=failure&per_page=100" | jq -c '.workflow_runs[] | select(.created_at >= "'${SINCE}'T00:00:00Z" and .created_at <= "'${UNTIL}'T23:59:59Z")')
69+
70+
RAW_RUNS=$(gh api "/repos/${TARGET_REPO}/actions/runs?branch=${BRANCH}&status=failure&per_page=100")
71+
if [ -z "$RAW_RUNS" ]; then
72+
echo "No API response or empty response for workflow runs." >&2
73+
else
74+
RUNS=$(echo "$RAW_RUNS" | jq -c '.workflow_runs[] | select(.created_at >= "'${SINCE}'T00:00:00Z" and .created_at <= "'${UNTIL}'T23:59:59Z")')
75+
fi
76+
7177
if [ -z "$RUNS" ]; then
7278
echo "No failed runs found in this window" >&2
7379
else

0 commit comments

Comments
 (0)