Skip to content

Badge Showing Coverage % for main branch for README.md file? #34

Description

@ardalis

Looking at the existing badge support I see it is generating an image like this one:

![Code Coverage](https://img.shields.io/badge/Code%20Coverage-97%25-success?style=flat)

This works fine in the PR comment but I'd like to include a badge in my project README with the latest coverage value from the main branch. Is this something this tool can help with, or does that require some separate service that would host the image?

Looking at the various shields.io branches for coverage, none of these seem like they would work with CodeCoverageSummary:
https://shields.io/category/coverage

Thanks for any tips.

Activity

  1. irongut commented on Feb 18, 2022

    @irongut
    Owner

    Hi @ardalis, at the moment CCS doesn't produce a badge for the readme but it is a feature I'd like to have.

    Ideally CCS would download the badge from shields.io and save it to a fixed location for the readme to reference. I've considered saving the badge to the root of the repo running the action but I'm not happy with that solution. I really don't want to write to users' repos.

    If you have any ideas I'm open to suggestions.

  2. ardalis commented on Feb 18, 2022

    @ardalis
    Author

    While looking for the latest in solving this problem the most promising item I found was this one. It's hacky but leverages gists rather than actual repo access:

    https://dev.to/thejaredwilcurt/coverage-badge-with-github-actions-finally-59fa

    HTH.

  3. irongut commented on Feb 18, 2022

    @irongut
    Owner

    That is an interesting solution. If I incorporate uploading the json file into CCS then the user would need to create a gist and supply its id and a PAT in the workflow. That doesn't sound too bad.

    Schneegans/dynamic-badges-action

  4. added this to the vNext+1 milestone on Feb 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions