From 251e5766f4bbc614ac21ba34c93760ec910b17ad Mon Sep 17 00:00:00 2001 From: cinco euzebio Date: Sat, 28 Feb 2026 22:32:19 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(ci):=20gerar=20badge=20SVG?= =?UTF-8?q?=20inline=20e=20remover=20tr=20com=20octais?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .drone.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.drone.yml b/.drone.yml index 86e4da2..d3bf2a1 100644 --- a/.drone.yml +++ b/.drone.yml @@ -26,18 +26,18 @@ steps: apt-get update -qq && apt-get install -y -qq jq curl PCT=$(cargo tarpaulin 2>&1 | awk '/coverage,/{print int($1)}') [ -z "$PCT" ] && PCT=0 - if [ "$PCT" -ge 80 ]; then COLOR="brightgreen" - elif [ "$PCT" -ge 60 ]; then COLOR="yellow" - else COLOR="red"; fi - echo "PCT=$PCT COLOR=$COLOR" - curl -sf "https://img.shields.io/badge/coverage-${PCT}%25-${COLOR}.svg" -o coverage.svg - CONTENT=$(cat coverage.svg | base64 | tr -d '\n') + if [ "$PCT" -ge 80 ]; then FILL="#4c1" + elif [ "$PCT" -ge 60 ]; then FILL="#dfb317" + else FILL="#e05d44"; fi + echo "PCT=$PCT FILL=$FILL" + printf 'coverage%s%%' "$FILL" "$PCT" > coverage.svg + CONTENT=$(base64 coverage.svg | tr -d '\n') echo "Content length: ${#CONTENT}" SHA_RESP=$(curl -s \ -H "Authorization: token $GITEA_TOKEN" \ "https://git.cincoeuzebio.com/api/v1/repos/cinco/Tmuxido/contents/badges/coverage.svg?ref=master") echo "SHA response: $SHA_RESP" - SHA=$(echo "$SHA_RESP" | tr -d '\000-\037' | jq -r '.sha // empty') + SHA=$(echo "$SHA_RESP" | jq -r '.sha // empty') echo "SHA: '$SHA'" if [ -n "$SHA" ]; then PAYLOAD=$(jq -n --arg msg "ci: update coverage badge [CI SKIP]" \ @@ -59,7 +59,7 @@ steps: -d "$PAYLOAD") fi echo "API response: $RESPONSE" - echo "$RESPONSE" | tr -d '\000-\037' | jq -e '.content.sha' > /dev/null + echo "$RESPONSE" | tr -d '\n' | jq -e '.content.sha' > /dev/null --- kind: pipeline