Skip to content

feat: add coverage badge GitHub Action#283

Merged
guyca merged 1 commit intomasterfrom
codeCoverageAction
Mar 3, 2026
Merged

feat: add coverage badge GitHub Action#283
guyca merged 1 commit intomasterfrom
codeCoverageAction

Conversation

@guyca
Copy link
Collaborator

@guyca guyca commented Mar 3, 2026

Restores the coverage badge that was removed in #257, using only official GitHub actions.

  • Adds .github/scripts/generate-coverage-badge.js — a zero-dependency Node.js script that reads packages/react-obsidian/coverage/coverage-summary.json, extracts line coverage %, picks a color, and emits a flat shield SVG with the label coverage
  • Adds a coverage job to ci.yml that runs after build on push to master: installs deps, runs yarn workspace react-obsidian run test-coverage, generates the badge SVG, then checks out the gh-pages branch and commits the badge to badges/coverage-jest coverage.svg

The existing README badge URL remains valid with no changes required.

Generates a coverage SVG badge from react-obsidian's Jest coverage summary
and commits it to the gh-pages branch on every push to master, using only
official GitHub actions (actions/checkout, actions/setup-node).

- Add .github/scripts/generate-coverage-badge.js to parse coverage-summary.json and emit a flat shield SVG with "coverage" label
- Add coverage job to ci.yml that runs after build, installs deps, runs test-coverage, generates the badge, and pushes it to gh-pages/badges/
@guyca guyca merged commit 17558c2 into master Mar 3, 2026
3 checks passed
@guyca guyca deleted the codeCoverageAction branch March 3, 2026 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant