Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ardalis opened this issue Feb 18, 2022 · 3 comments
Open

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

ardalis opened this issue Feb 18, 2022 · 3 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@ardalis
Copy link

ardalis commented Feb 18, 2022

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.

@ardalis ardalis added the enhancement New feature or request label Feb 18, 2022
@irongut
Copy link
Owner

irongut commented Feb 18, 2022

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.

@ardalis
Copy link
Author

ardalis commented Feb 18, 2022

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.

@irongut
Copy link
Owner

irongut commented Feb 18, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants