Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions lib/utils.bash
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,17 @@ sort_versions() {
}

fetch_all_assets() {
curl -s -H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${GH_REPO}/releases |
jq -r '.[0].assets[] | "\(.name) \(.browser_download_url)"'
local releases_json
releases_json="$(curl -s -H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${GH_REPO}/releases)"

# Validate that the response is an array (successful), otherwise print and fail
if ! echo "$releases_json" | jq -e 'type == "array"' >/dev/null; then
echo "$releases_json" | jq '.' # Optionally print error for debugging
fail "GitHub API did not return a valid releases array - likely rate-limited or network error."
fi

echo "$releases_json" | jq -r '.[0].assets[] | "\(.name) \(.browser_download_url)"'
}

validate_platform() {
Expand Down
Loading