🐛 fix: prevent duplicate badges with improved detection logic
This commit is contained in:
@@ -4,8 +4,8 @@
|
||||
[](https://goreportcard.com/report/github.com/arcodange/dance-lessons-coach)
|
||||
[](https://gitea.arcodange.fr/arcodange/dance-lessons-coach/releases)
|
||||
[](LICENSE)
|
||||
[](https://gitea.arcodange.lab/arcodange/dance-lessons-coach)
|
||||
[](https://gitea.arcodange.lab/arcodange/dance-lessons-coach)
|
||||
[](https://gitea.arcodange.lab/arcodange/dance-lessons-coach)
|
||||
|
||||
A Go project demonstrating idiomatic package structure, CLI implementation, and JSON API with Chi router.
|
||||
=======
|
||||
|
||||
@@ -69,6 +69,20 @@ if grep -q "${BADGE_TYPE}_Coverage-${COVERAGE}%" README.md || grep -q "coverage-
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Also check if badge already exists with this coverage (more flexible pattern)
|
||||
if [ "$BADGE_TYPE" = "bdd" ] || [ "$BADGE_TYPE" = "unit" ]; then
|
||||
# Capitalize first letter for badge name
|
||||
if [ "$BADGE_TYPE" = "unit" ]; then
|
||||
BADGE_NAME="Unit"
|
||||
else
|
||||
BADGE_NAME="BDD"
|
||||
fi
|
||||
if grep -q "\[!\[${BADGE_NAME} Coverage\].*${COVERAGE}%" README.md; then
|
||||
echo "Coverage badge already exists at ${COVERAGE}%"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
# Cross-platform sed command
|
||||
# Detect if we're on macOS (BSD sed) or Linux (GNU sed)
|
||||
SED_CMD=""
|
||||
|
||||
Reference in New Issue
Block a user