From 0e1f3f3942ffe924fcfa7eba4221bae5e4633345 Mon Sep 17 00:00:00 2001 From: Harold Torres Date: Wed, 1 Apr 2026 13:04:02 +1100 Subject: [PATCH] chore: replace coverage-badge-js action with custom node script for badge generation --- .github/workflows/ci.yml | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 25eaa57..93f77d0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -78,9 +78,37 @@ jobs: # Only update the badge on pushes to main (not on PRs) - name: Generate coverage badge if: github.ref == 'refs/heads/main' && github.event_name == 'push' - uses: tj-actions/coverage-badge-js@v2 - with: - output: coverage-badge.svg + run: | + node -e " + const fs = require('fs'); + const summary = JSON.parse(fs.readFileSync('coverage/coverage-summary.json', 'utf8')); + const pct = summary.total.lines.pct; + const color = pct >= 90 ? '#4c1' : pct >= 75 ? '#dfb317' : '#e05d44'; + const label = 'coverage'; + const value = pct + '%'; + const svg = [ + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '' + label + '', + '' + label + '', + '' + value + '', + '' + value + '', + '', + '' + ].join(''); + fs.writeFileSync('coverage-badge.svg', svg); + console.log('Generated badge: ' + pct + '%'); + " - name: Commit coverage badge if: github.ref == 'refs/heads/main' && github.event_name == 'push'