Skip to content

tj-actions/coverage-badge-js

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

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

All Contributors

coverage-badge-js

Generate coverage badge like this coverage badge using Istanbul's JSON summary reporter without uploading results to a 3rd party site.

Usage

...
    steps:
      - uses: actions/checkout@v4
      - name: Generate coverage badge
        uses: tj-actions/coverage-badge-js@v2

Inputs

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

Example

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

If you feel generous and want to show some extra appreciation:

Buy me a coffee

Features

  • Generate a coverage badge from a coverage report.

Credits

This package was created with Cookiecutter.

Report Bugs

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.

Contributors ✨

Thanks goes to these wonderful people (emoji key):

Raphael Boidol
Raphael Boidol

📖

This project follows the all-contributors specification. Contributions of any kind welcome!