diff --git a/git-pages/files/retention-cleanup.sh b/git-pages/files/retention-cleanup.sh index 6f9aece..8398439 100644 --- a/git-pages/files/retention-cleanup.sh +++ b/git-pages/files/retention-cleanup.sh @@ -33,6 +33,15 @@ branch_exists() { BRANCH_CACHE[$key]=1 return 0 fi + + # API error or branch not found - log warning and keep report (fail-safe) + if [ "$status" != "404" ]; then + echo " WARN: Gitea API error for ${owner}/${repo}/${branch} (status ${status}) - KEEPING report" + BRANCH_CACHE[$key]=1 # cache as "exists" to avoid repeated errors + return 0 + fi + + # Actual 404 - branch truly doesn't exist return 1 }