From 2b46fd1ee7b16bc8d067529b6faeb51692699c33 Mon Sep 17 00:00:00 2001 From: Kevin Costner <120246174+kevincostner17@users.noreply.github.com> Date: Tue, 15 Sep 2026 21:38:33 +0530 Subject: [PATCH] ci: retry the coverage badge push Non-PR CI runs are grouped per commit, so back-to-back merges run the coverage-badge job concurrently. Its force push to the badges branch failed once transiently during such a burst (run 34958472308) and turned main red. Retry the push up to four times with backoff before failing. --- .github/workflows/ci.yml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c43a801f..97aa7798 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -306,5 +306,16 @@ jobs: git checkout -q -b badges git add coverage.json git commit -q -m "Update coverage badge" - git push -q --force \ - "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" badges + # Back-to-back merges run this job concurrently on different commits, + # and a force push can fail transiently (ref lock, network). Retry with + # backoff so a badge update never turns main red. + for attempt in 1 2 3 4; do + if git push -q --force \ + "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" badges; then + exit 0 + fi + echo "badge push attempt ${attempt} failed; retrying" + sleep $((attempt * 10)) + done + echo "::warning::coverage badge push failed after 4 attempts" + exit 1