Skip to content

Commit 2afee2f

Browse files
knowledgecodeclaude
andcommitted
Fix coverage job JSON parsing error in CI workflow
Use jq to extract coverage percentage instead of outputting entire JSON. This resolves GitHub Actions output format error caused by multiline JSON. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 7a74c2a commit 2afee2f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

.github/workflows/test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@ jobs:
5252
- name: Read coverage summary
5353
id: coverage
5454
run: |
55-
echo "summary=$(cat coverage/coverage-summary.json)" >> $GITHUB_OUTPUT
55+
echo "pct=$(jq '.total.lines.pct' coverage/coverage-summary.json)" >> $GITHUB_OUTPUT
5656
5757
- name: Generate coverage badge
5858
uses: emibcn/badge-action@v2.0.3
5959
with:
6060
label: 'coverage'
61-
status: ${{ fromJson(steps.coverage.outputs.summary).total.lines.pct }}%
62-
color: ${{ fromJson(steps.coverage.outputs.summary).total.lines.pct > 80 && 'brightgreen' || fromJson(steps.coverage.outputs.summary).total.lines.pct > 60 && 'yellow' || 'red' }}
61+
status: ${{ steps.coverage.outputs.pct }}%
62+
color: ${{ steps.coverage.outputs.pct > 80 && 'brightgreen' || steps.coverage.outputs.pct > 60 && 'yellow' || 'red' }}
6363
path: badges/coverage.svg
6464
style: flat
6565

0 commit comments

Comments
 (0)