feat: add dynamic code coverage badge#87
Merged
Conversation
Extract line coverage percentage from npm run test:coverage output and update a shields.io endpoint badge via GitHub Gist on pushes to main. Uses schneegans/dynamic-badges-action with continue-on-error so CI is not blocked if GIST_TOKEN is not set. Badge added to README.md between Security and VS Code Marketplace badges. Gist: d01e4551b744b77e2927555e43a4b935 Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
Badge SVG endpoints are prone to transient 500 errors that cause false positive link checker failures. Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
When a PR merges, the post-merge workflow now iterates all open PRs and runs gh pr update-branch on each. This eliminates the manual 'Update branch' click when strict status checks require branches to be up to date. Also enabled allow_update_branch on the repo via API. Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add a dynamic code coverage badge to the README that auto-updates on every push to main.
How it works
unit-testCI job already runsnpm run test:coverageon ubuntu-latestschneegans/dynamic-badges-actionupdates a shields.io endpoint JSON in a GitHub GistSame pattern used by patchloom/patchloom.
Setup required
Set the
GIST_TOKENrepo secret (classic PAT withgistscope, same token used in patchloom/patchloom). Without it, the badge update step is skipped (continue-on-error: true).Changes
.github/workflows/ci.yml: Extract coverage percentage, determine badge color, update Gist on main pushesREADME.md: Add coverage badge between Security and VS Code Marketplace badgesCurrent coverage: 82% line coverage across 206 tests.