🐛 fix: cross-platform sed and badge replacement issues
This commit is contained in:
@@ -71,7 +71,17 @@ if [ "$BADGE_TYPE" = "bdd" ] || [ "$BADGE_TYPE" = "unit" ]; then
|
||||
$SED_CMD "s|https://img.shields.io/badge/${BADGE_TYPE}_Coverage-.*-.*?style=flat-square|${BADGE_URL}|" README.md
|
||||
else
|
||||
# Add new badge line after the main coverage badge
|
||||
$SED_CMD "/coverage-.*-.*?style=flat-square/a\\n${BADGE_URL}" README.md
|
||||
# Use a more reliable approach with temporary file for cross-platform compatibility
|
||||
TEMP_FILE=$(mktemp)
|
||||
awk -v new_badge="${BADGE_URL}" '
|
||||
/coverage-.*-.*?style=flat-square/ {
|
||||
print $0
|
||||
print new_badge
|
||||
next
|
||||
}
|
||||
{print}
|
||||
' README.md > "$TEMP_FILE"
|
||||
mv "$TEMP_FILE" README.md
|
||||
fi
|
||||
else
|
||||
# For combined coverage, use the original logic
|
||||
|
||||
Reference in New Issue
Block a user