Works with private repos!
I had to work on a few private repos and really wanted an automated coverage badge. However, a lot of the options available used third-party services. Thus, coverage-badge can create badges with nobody having access
There are a few steps to set up the workflow to auto update a README.md
or similar file
- Add the following two sequential comment anywhere in your file. Preferably, push it to the bottom
<!-- Coverage Comment:Begin --> <!-- Coverage Comment:End -->
- Add the following wherever you want to see the badge:
![Coverage][coverage_badge]
- Update your testing workflow as needed, make sure the
actions/checkout
can write in to your repo--- on: push: jobs: test: name: Test the github action runs-on: ubuntu-latest permissions: contents: write steps: - uses: kevinfjiang/coverage-badge@v1 with: coverage: 100 change_file: ./README.md
Parameter | Description | Default |
---|---|---|
coverage ** |
Code coverage as a percentage in range [0, 100] | Required |
color |
Color of badge. {0-59: red, 60-89: yellow, 80-100: green} | "" |
change_file |
Files to be changed, by default doesn't modify files | "" |
style |
shield.io styling of badge | "for-the-badge" |
repo_token |
GitHub Action token | secrets.GITHUB_TOKEN |
ref |
Branch to commit new changes onto | github.head_ref |
The following output values can be accessed via ${{ steps.<step-id>.outputs.<output-name> }}
:
Name | Description | Type |
---|---|---|
badge |
shield.io badge url | string |
- Parameters denoted with
**
are required. - The
change_file
parameter supports multiple files separated by a space