🔄 fix: add race condition handling for concurrent coverage updates
Some checks failed
CI/CD Pipeline / CI Pipeline (pull_request) Has been cancelled

This commit is contained in:
2026-04-07 08:15:27 +02:00
parent b21c5fb093
commit c609a4ca48

View File

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