Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions core/core.func
Original file line number Diff line number Diff line change
Expand Up @@ -928,6 +928,8 @@ log_section() {
# - Temporarily disables error trap to capture exit code correctly
# ------------------------------------------------------------------------------
silent() {
# A failure the caller handled (a retry loop) must not be reported for a later, unrelated error.
unset _SILENT_FAILED_RC _SILENT_FAILED_CMD _SILENT_FAILED_LINE _SILENT_FAILED_LOG
local cmd="$*"
local caller_line="${BASH_LINENO[0]:-unknown}"
local logfile="$(get_active_logfile)"
Expand Down
13 changes: 9 additions & 4 deletions lib/forge.func
Original file line number Diff line number Diff line change
Expand Up @@ -1473,7 +1473,7 @@ _forge_release_json() {
fi

local -a timeouts=(60 120 240)
local raw attempt=1 delay=2 code ok=false
local raw attempt=1 delay=2 code ok=false curl_rc
raw="$(mktemp /tmp/tools-forge-rel-XXXXXX)" || return 73

local -a headers=()
Expand All @@ -1485,13 +1485,18 @@ _forge_release_json() {
[[ -n "$auth" ]] && headers+=(-H "$auth")

while ((attempt <= ${#timeouts[@]})); do
curl_rc=0
code="$(curl -sSL -w "%{http_code}" -o "$raw" \
--max-time "${timeouts[$((attempt - 1))]}" \
"${headers[@]}" "$api_url" 2>/dev/null)" || true
"${headers[@]}" "$api_url" 2>/dev/null)" || curl_rc=$?

if [[ "$code" == "200" ]]; then
ok=true
break
# A body cut short still reports 200, and jq then finds no release at all.
if ((curl_rc == 0)) && jq -e 'type == "array" or type == "object"' "$raw" >/dev/null 2>&1; then
ok=true
break
fi
code="000"
fi

if [[ "$forge" == "github" && "$code" == "401" ]]; then
Expand Down
Loading