Skip to content

Commit c0eb665

Browse files
authored
fix: try to fix CI failures on macOS
1 parent e95b0bc commit c0eb665

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

lib/utils.bash

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,21 @@ sort_versions() {
4646
}
4747

4848
fetch_all_assets() {
49-
curl -s -H "Accept: application/vnd.github.v3+json" \
50-
https://api.github.com/repos/${GH_REPO}/releases |
51-
jq -r '.[0].assets[] | "\(.name) \(.browser_download_url)"'
49+
local attempts=0
50+
local releases_json
51+
while [ $attempts -lt 5 ]; do
52+
releases_json="$(curl -s -H "Accept: application/vnd.github.v3+json" \
53+
https://api.github.com/repos/${GH_REPO}/releases)"
54+
if echo "$releases_json" | jq -e 'type == "array"' >/dev/null; then
55+
echo "$releases_json" | jq -r '.[0].assets[] | "\(.name) \(.browser_download_url)"'
56+
return 0
57+
fi
58+
log "Failed to fetch releases (attempt $((attempts+1))). Retrying in 2s..."
59+
sleep 2
60+
attempts=$((attempts+1))
61+
done
62+
echo "$releases_json" | jq '.' # Print last error
63+
fail "GitHub API did not return a valid releases array after $attempts attempts."
5264
}
5365

5466
validate_platform() {

0 commit comments

Comments
 (0)