Skip to content

Commit 13ff83e

Browse files
ci: retry the coverage badge push (#418)
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.
1 parent 3b4bde4 commit 13ff83e

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,5 +306,16 @@ jobs:
306306
git checkout -q -b badges
307307
git add coverage.json
308308
git commit -q -m "Update coverage badge"
309-
git push -q --force \
310-
"https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" badges
309+
# Back-to-back merges run this job concurrently on different commits,
310+
# and a force push can fail transiently (ref lock, network). Retry with
311+
# backoff so a badge update never turns main red.
312+
for attempt in 1 2 3 4; do
313+
if git push -q --force \
314+
"https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" badges; then
315+
exit 0
316+
fi
317+
echo "badge push attempt ${attempt} failed; retrying"
318+
sleep $((attempt * 10))
319+
done
320+
echo "::warning::coverage badge push failed after 4 attempts"
321+
exit 1

0 commit comments

Comments
 (0)