ci: add debug output to coverage upload step

This commit is contained in:
Cinco Euzebio 2026-02-28 21:44:08 -03:00
parent ef13e884ba
commit 7e70157097

View File

@ -32,11 +32,14 @@ steps:
else COLOR="red"; fi
curl -sf "https://img.shields.io/badge/coverage-${PCT}%25-${COLOR}.svg" -o coverage.svg
- |
echo "Badge size: $(wc -c < coverage.svg) bytes"
SHA=$(curl -sf \
-H "Authorization: token $GITEA_TOKEN" \
"https://git.cincoeuzebio.com/api/v1/repos/cinco/Tmuxido/contents/badges/coverage.svg?ref=master" \
| jq -r '.sha // empty')
| jq -r '.sha // empty' || echo "")
echo "Existing SHA: '${SHA}'"
CONTENT=$(base64 -w 0 coverage.svg)
echo "Content length: ${#CONTENT}"
if [ -n "$SHA" ]; then
PAYLOAD=$(jq -n --arg msg "ci: update coverage badge [CI SKIP]" \
--arg content "$CONTENT" --arg sha "$SHA" --arg branch "master" \
@ -46,11 +49,13 @@ steps:
--arg content "$CONTENT" --arg branch "master" \
'{message: $msg, content: $content, branch: $branch}')
fi
curl -fsSL -X PUT \
RESPONSE=$(curl -s -X PUT \
-H "Authorization: token $GITEA_TOKEN" \
-H "Content-Type: application/json" \
"https://git.cincoeuzebio.com/api/v1/repos/cinco/Tmuxido/contents/badges/coverage.svg" \
-d "$PAYLOAD"
-d "$PAYLOAD")
echo "API response: $RESPONSE"
echo "$RESPONSE" | jq -e '.content.sha' > /dev/null
---
kind: pipeline