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 ./...