diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7c06842..a56cd1f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,7 +24,7 @@ jobs: command: clang-tidy --version - plugin: clang-apply-replacements command: clang-apply-replacements --version - version: ["8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20"] + version: ["16", "17", "18", "19", "20"] steps: - name: Install asdf diff --git a/lib/utils.bash b/lib/utils.bash index cc716cb..d205d24 100644 --- a/lib/utils.bash +++ b/lib/utils.bash @@ -46,9 +46,23 @@ 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 response + response=$(curl "${curl_opts[@]}" -H "Accept: application/vnd.github.v3+json" \ + "https://api.github.com/repos/${GH_REPO}/releases") + + # Check for GitHub API error (e.g., rate limit exceeded) + if echo "$response" | jq -e 'type == "object" and has("message")' >/dev/null; then + local message + message=$(echo "$response" | jq -r '.message') + fail "GitHub API error: $message" + fi + + # Validate it's an array + if ! echo "$response" | jq -e 'type == "array"' >/dev/null; then + fail "Unexpected GitHub response (not a release list array): $response" + fi + + echo "$response" | jq -r '.[0].assets[] | "\(.name) \(.browser_download_url)"' } validate_platform() {