From 622e8acdc57cc73dd369f8eced3a7936e22b7b73 Mon Sep 17 00:00:00 2001 From: moilanik Date: Sun, 14 Jun 2026 09:14:52 +0300 Subject: [PATCH] fix(retention): fail-safe on Gitea API errors - Keep reports when Gitea API returns non-200/non-404 status - Only delete on actual 404 (branch truly doesn't exist) - Log warning for API errors to aid debugging --- git-pages/files/retention-cleanup.sh | 9 +++++++++ 1 file changed, 9 insertions(+) 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 }