Skip to content

kevinfjiang/coverage-badge

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

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Coverage Badge

Works with private repos!

Build Coverage

Why?

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

Guide

There are a few steps to set up the workflow to auto update a README.md or similar file

  1. Add the following two sequential comment anywhere in your file. Preferably, push it to the bottom
    <!-- Coverage Comment:Begin --> <!-- Coverage Comment:End -->
  2. Add the following wherever you want to see the badge: ![Coverage][coverage_badge]
  3. 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

Supported Parameters

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

Outputs

The following output values can be accessed via ${{ steps.<step-id>.outputs.<output-name> }}:

Name Description Type
badge shield.io badge url string

Notes:

  • Parameters denoted with ** are required.
  • The change_file parameter supports multiple files separated by a space

About

GitHub action for adding a coverage badge to a README

Resources

License

Stars

Watchers

Forks

Packages

No packages published