🐛 fix: ensure single push in CI/CD workflow
All checks were successful
CI/CD Pipeline / Build Docker Cache (push) Successful in 11s
CI/CD Pipeline / CI Pipeline (push) Successful in 4m26s

This commit is contained in:
2026-04-08 16:43:22 +02:00
parent 14a8bc3714
commit 194b2aeb0e
3 changed files with 51 additions and 8 deletions

View File

@@ -1,7 +1,8 @@
#!/bin/bash
# CI script to update coverage badge in README.md
# Usage: scripts/ci-update-coverage-badge.sh <coverage_percentage> [badge_type]
# Usage: scripts/ci-update-coverage-badge.sh <coverage_percentage> [badge_type] [flags]
# badge_type can be "bdd", "unit", or empty for combined coverage
# flags: --no-commit (skip git commit), --no-push (skip git push)
set -e
@@ -13,6 +14,18 @@ fi
COVERAGE=$1
BADGE_TYPE=${2:-"combined"}
# Parse flags
NO_COMMIT=false
NO_PUSH=false
for arg in "$@"; do
if [ "$arg" = "--no-commit" ]; then
NO_COMMIT=true
elif [ "$arg" = "--no-push" ]; then
NO_PUSH=true
fi
done
# Determine badge color
if (( $(echo "$COVERAGE >= 80" | bc -l) )); then
COLOR="brightgreen"
@@ -76,7 +89,22 @@ if [ -n "$PACKAGES_TOKEN" ]; then
fi
git add README.md
# Skip commit if --no-commit flag is set
if [ "$NO_COMMIT" = true ]; then
echo "Skipping git commit due to --no-commit flag"
echo "Coverage badge updated to ${COVERAGE}% in README.md (not committed)"
exit 0
fi
if git commit -m "🤖 chore: update coverage badge to ${COVERAGE}% [skip ci]"; then
# Skip push if --no-push flag is set
if [ "$NO_PUSH" = true ]; then
echo "Skipping git push due to --no-push flag"
echo "Coverage badge updated to ${COVERAGE}% and committed locally"
exit 0
fi
# Try push with retry logic for race conditions
for i in 1 2 3; do
if git push; then