From 6d62f87660996039c412e557c89bd1dd2eed8978 Mon Sep 17 00:00:00 2001 From: Stijnvandenbroek Date: Wed, 11 Mar 2026 13:57:54 +0000 Subject: [PATCH] fix: round coverage before json --- .github/workflows/ci.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8f54125..9d09123 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -86,15 +86,22 @@ jobs: - name: Round coverage percentage if: github.ref == 'refs/heads/main' run: | - COVERAGE=$(python -c "import json; print(round(json.load(open('coverage.json'))['totals']['percent_covered']))") - echo "COVERAGE=$COVERAGE" >> $GITHUB_ENV + python -c " + import json + with open('coverage.json') as f: + data = json.load(f) + data['totals']['percent_covered'] = round(data['totals']['percent_covered']) + with open('coverage.json', 'w') as f: + json.dump(data, f) + " - name: Generate coverage badge if: github.ref == 'refs/heads/main' uses: jaywcjlove/coverage-badges-cli@v2.1.0 with: + source: coverage.json output: badge/coverage-badge.svg - value: ${{ env.COVERAGE }}% + jsonPath: totals.percent_covered - name: Deploy coverage badge if: github.ref == 'refs/heads/main'