Generate coverage.py badge like this without uploading results to a 3rd party site.
...
steps:
- uses: actions/checkout@v4
- name: Coverage Badge
uses: tj-actions/coverage-badge-py@v2
Warning
- It's important that you run this action from the directory where the .coverage data file is located.
If you feel generous and want to show some extra appreciation:
Support this project with a ⭐
- uses: tj-actions/coverage-badge-py@v2
id: coverage-badge-py
with:
# Output path to write the
# coverage badge.
# Type: string
# Default: "coverage.svg"
output: ''
# Overwrite an existing coverage badge.
# Type: boolean
# Default: "true"
overwrite: ''
# Current working directory
# Type: string
# Default: "."
working-directory: ''
...
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install dependencies
...
- name: Run coverage
run: |
coverage run ...
coverage report -m
- name: Coverage Badge
uses: tj-actions/coverage-badge-py@v2
- name: Verify Changed files
uses: tj-actions/verify-changed-files@v16
id: verify-changed-files
with:
files: coverage.svg
- name: Commit files
if: steps.verify-changed-files.outputs.files_changed == 'true'
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add coverage.svg
git commit -m "Updated coverage.svg"
- name: Push changes
if: steps.verify-changed-files.outputs.files_changed == 'true'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.github_token }}
branch: ${{ github.ref }}
- Free software: MIT license
This package was created with Cookiecutter.
Report bugs at https://github.com/tj-actions/coverage-badge-py/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!