From c609a4ca4897352e0c5c7e957270b8932a3a243a Mon Sep 17 00:00:00 2001 From: Gabriel Radureau Date: Tue, 7 Apr 2026 08:15:27 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=84=20fix:=20add=20race=20condition=20?= =?UTF-8?q?handling=20for=20concurrent=20coverage=20updates?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/ci-cd.yaml | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/.gitea/workflows/ci-cd.yaml b/.gitea/workflows/ci-cd.yaml index 596e24f..739b059 100644 --- a/.gitea/workflows/ci-cd.yaml +++ b/.gitea/workflows/ci-cd.yaml @@ -110,9 +110,29 @@ jobs: git config --global credential.helper store echo "https://${{ secrets.PACKAGES_TOKEN }}@gitea.arcodange.lab" > ~/.git-credentials - git add README.md - git commit -m "🤖 chore: update coverage badge to ${COVERAGE}% [skip ci]" || echo "No coverage change to commit" - git push || echo "Push failed - may be duplicate commit" + # Only update if coverage has actually changed + if grep -q "coverage-${COVERAGE}%" README.md; then + echo "Coverage badge already up to date at ${COVERAGE}%" + else + git add README.md + git commit -m "🤖 chore: update coverage badge to ${COVERAGE}% [skip ci]" || echo "No coverage change to commit" + + # Try push with retry logic for race conditions + for i in 1 2 3; do + if git push; then + echo "Successfully updated coverage badge to ${COVERAGE}%" + break + else + echo "Push attempt $i failed, retrying..." + if [ $i -eq 3 ]; then + echo "Final push attempt failed - another job may have updated the badge" + git pull --rebase || true + git push || echo "Recovery push also failed" + fi + sleep 2 + fi + done + fi - name: Run go fmt run: go fmt ./...