Skip to content

:octocat: Github action to generate coverage badge without uploading results to a 3rd party.

License

Notifications You must be signed in to change notification settings

googio/coverage-badge-py

 
 

Repository files navigation

Codacy Badge CI Update release version. Public workflows that use this action.

Ubuntu Mac OS Windows

coverage-badge-py

Generate coverage.py badge like this coverage badge without uploading results to a 3rd party site.

Usage:

...
    steps:
      - uses: actions/checkout@v2
      - name: Coverage Badge
        uses: tj-actions/coverage-badge-py@v2

NOTE: ⚠️

  • 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 ⭐

Buy me a coffee

Inputs

INPUT TYPE REQUIRED DEFAULT DESCRIPTION
output string false "coverage.svg" Output path to write the coverage
badge.
overwrite string false "true" Overwrite an existing coverage badge.
working-directory string false "." Current working directory

Example

...
    steps:
      - uses: actions/checkout@v2
        with: 
          fetch-depth: 0

      - 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@v13
        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 }}

Credits

This package was created with Cookiecutter.

Report Bugs

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.

About

:octocat: Github action to generate coverage badge without uploading results to a 3rd party.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%