- Fix badge URLs and remove duplicates - Add update-all-badges.sh script for single commit updates - Update CI/CD workflow to use environment variables - Remove complex sequential commit logic - Follow KISS principle with simple env var approach
51 lines
1.5 KiB
Bash
Executable File
51 lines
1.5 KiB
Bash
Executable File
#!/bin/bash
|
||
# Simple script to update coverage badges in README.md
|
||
# Usage: ./scripts/update-all-badges.sh [bdd_coverage] [unit_coverage]
|
||
# Both parameters are optional - only updates what's provided
|
||
|
||
set -e
|
||
|
||
BDD_COVERAGE=""
|
||
UNIT_COVERAGE=""
|
||
|
||
# Parse arguments (both optional)
|
||
if [ -n "$1" ]; then
|
||
BDD_COVERAGE=$1
|
||
fi
|
||
|
||
if [ -n "$2" ]; then
|
||
UNIT_COVERAGE=$2
|
||
fi
|
||
|
||
echo "🎯 Updating coverage badges..."
|
||
if [ -n "$BDD_COVERAGE" ]; then
|
||
echo " BDD: ${BDD_COVERAGE}%"
|
||
fi
|
||
if [ -n "$UNIT_COVERAGE" ]; then
|
||
echo " Unit: ${UNIT_COVERAGE}%"
|
||
fi
|
||
|
||
# Update BDD coverage badge if provided
|
||
if [ -n "$BDD_COVERAGE" ] && grep -q "BDD_Coverage" README.md; then
|
||
sed -i '' "s/BDD_Coverage-[0-9.]\+-%/BDD_Coverage-${BDD_COVERAGE}-%/g" README.md
|
||
echo "✅ BDD coverage badge updated to ${BDD_COVERAGE}%"
|
||
fi
|
||
|
||
# Update Unit coverage badge if provided
|
||
if [ -n "$UNIT_COVERAGE" ] && grep -q "Unit_Coverage" README.md; then
|
||
sed -i '' "s/Unit_Coverage-[0-9.]\+-%/Unit_Coverage-${UNIT_COVERAGE}-%/g" README.md
|
||
echo "✅ Unit coverage badge updated to ${UNIT_COVERAGE}%"
|
||
fi
|
||
|
||
# Update main coverage badge if BDD coverage provided
|
||
if [ -n "$BDD_COVERAGE" ] && grep -q "coverage-[0-9.]\+-%" README.md; then
|
||
sed -i '' "s/coverage-[0-9.]\+-%/coverage-${BDD_COVERAGE}-%/g" README.md
|
||
echo "✅ Main coverage badge updated to ${BDD_COVERAGE}%"
|
||
fi
|
||
|
||
if [ -z "$BDD_COVERAGE" ] && [ -z "$UNIT_COVERAGE" ]; then
|
||
echo "ℹ️ No coverage values provided - nothing to update"
|
||
fi
|
||
|
||
echo "🎉 Badge update process completed!"
|