Generate coverage badge like this using Istanbul's JSON summary reporter without uploading results to a 3rd party site.
- Configure Istanbul's JSON summary reporter
...
steps:
- uses: actions/checkout@v4
- name: Generate coverage badge
uses: tj-actions/coverage-badge-js@v2
INPUT | TYPE | REQUIRED | DEFAULT | DESCRIPTION |
---|---|---|---|---|
output_path | string | true | "coverage/badge.svg" |
Writes the coverage badge to the given path |
path | string | true | "." |
Path to the application |
report_path | string | true | "coverage/coverage-summary.json" |
Path to a coverage report file |
Generate a coverage badge after running your test and create a Pull request with those changes.
...
- name: Generate coverage badge
uses: tj-actions/coverage-badge-js@v2
with:
path: test-app
- name: Verify Changed files
uses: tj-actions/verify-changed-files@v6.1
id: verify-changed-files
with:
files: |
test-app/coverage/badge.svg
- name: Create Pull Request
if: steps.verify-changed-files.outputs.files_changed == 'true'
uses: peter-evans/create-pull-request@v3
with:
base: "main"
title: "Updated coverage badge"
branch: "chore/update-coverage-badge"
commit-message: "Updated coverage badge."
body: "Updated coverage badge."
token: ${{ github.token }}
- Free software: MIT license
If you feel generous and want to show some extra appreciation:
- Generate a coverage badge from a coverage report.
This package was created with Cookiecutter.
Report bugs at https://github.com/tj-actions/coverage-badge-js/issues.
If you are reporting a bug, please include:
- Your operating system name and version.
- Any details about your workflow that might be helpful in troubleshooting.
- Detailed steps to reproduce the bug.
Thanks goes to these wonderful people (emoji key):
Raphael Boidol 📖 |
This project follows the all-contributors specification. Contributions of any kind welcome!