mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2025-12-11 05:47:13 -06:00
fix(tools): handle repos with 30+ pre-releases in check_for_gh_release (#9786)
This commit is contained in:
parent
f2597f4d35
commit
0bcffdc8b0
@ -1453,15 +1453,32 @@ check_for_gh_release() {
|
||||
|
||||
ensure_dependencies jq
|
||||
|
||||
# Fetch releases and exclude drafts/prereleases
|
||||
local releases_json
|
||||
releases_json=$(curl -fsSL --max-time 20 \
|
||||
-H 'Accept: application/vnd.github+json' \
|
||||
-H 'X-GitHub-Api-Version: 2022-11-28' \
|
||||
"https://api.github.com/repos/${source}/releases") || {
|
||||
msg_error "Unable to fetch releases for ${app}"
|
||||
return 1
|
||||
}
|
||||
# Try /latest endpoint for non-pinned versions (most efficient)
|
||||
local releases_json=""
|
||||
|
||||
if [[ -z "$pinned_version_in" ]]; then
|
||||
releases_json=$(curl -fsSL --max-time 20 \
|
||||
-H 'Accept: application/vnd.github+json' \
|
||||
-H 'X-GitHub-Api-Version: 2022-11-28' \
|
||||
"https://api.github.com/repos/${source}/releases/latest" 2>/dev/null)
|
||||
|
||||
if [[ $? -eq 0 ]] && [[ -n "$releases_json" ]]; then
|
||||
# Wrap single release in array for consistent processing
|
||||
releases_json="[$releases_json]"
|
||||
fi
|
||||
fi
|
||||
|
||||
# If no releases yet (pinned version OR /latest failed), fetch up to 100
|
||||
if [[ -z "$releases_json" ]]; then
|
||||
# Fetch releases and exclude drafts/prereleases
|
||||
releases_json=$(curl -fsSL --max-time 20 \
|
||||
-H 'Accept: application/vnd.github+json' \
|
||||
-H 'X-GitHub-Api-Version: 2022-11-28' \
|
||||
"https://api.github.com/repos/${source}/releases?per_page=100") || {
|
||||
msg_error "Unable to fetch releases for ${app}"
|
||||
return 1
|
||||
}
|
||||
fi
|
||||
|
||||
mapfile -t raw_tags < <(jq -r '.[] | select(.draft==false and .prerelease==false) | .tag_name' <<<"$releases_json")
|
||||
if ((${#raw_tags[@]} == 0)); then
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user