🐛 fix: prevent duplicate badges with improved detection logic
All checks were successful
CI/CD Pipeline / Build Docker Cache (push) Successful in 9s
CI/CD Pipeline / CI Pipeline (push) Successful in 4m32s

This commit is contained in:
2026-04-08 17:57:54 +02:00
parent bad3de6653
commit b308d9d095
2 changed files with 15 additions and 1 deletions

View File

@@ -4,8 +4,8 @@
[![Go Report Card](https://goreportcard.com/badge/github.com/arcodange/dance-lessons-coach)](https://goreportcard.com/report/github.com/arcodange/dance-lessons-coach)
[![Version](https://img.shields.io/badge/version-1.4.0-blue.svg)](https://gitea.arcodange.fr/arcodange/dance-lessons-coach/releases)
[![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
[![Unit Coverage](https://img.shields.io/badge/Unit_Coverage-8.4%-red?style=flat-square)](https://gitea.arcodange.lab/arcodange/dance-lessons-coach)
[![BDD Coverage](https://img.shields.io/badge/BDD_Coverage-55.9%-yellow?style=flat-square)](https://gitea.arcodange.lab/arcodange/dance-lessons-coach)
[![Unit Coverage](https://img.shields.io/badge/Unit_Coverage-8.4%-red?style=flat-square)](https://gitea.arcodange.lab/arcodange/dance-lessons-coach)
A Go project demonstrating idiomatic package structure, CLI implementation, and JSON API with Chi router.
=======

View File

@@ -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=""