CodeCoverageSummary icon indicating copy to clipboard operation
CodeCoverageSummary copied to clipboard

Need help to understand how to use CodeCoverageSumarry for a badge

Open Erwan-BR opened this issue 2 years ago • 3 comments

Hello,

First of all I'm sorry if I'm not in the right place to ask the question, I don't know where to do it more efficiently.

I'd like to know how I can make it so that when a merge request is accepted, a badge is automatically created with the information that codeCoverage generates.

Here's the link to the yml file I'm using for my project:

Link of my yam

And I noticed (not on this repo, but on another with the same yml), that I do have the bot that generates this comment:

image

I'd really like the badge to automatically appear on the second line of my README.md file when the merge is accepted!

Thanks in advance :)

Erwan-BR avatar Oct 20 '23 19:10 Erwan-BR

A possible solution for this is as follows:

  1. Create an action that runs when a PR is merged, in that you:
  2. Generate the new coverage data
  3. Modify your README using a script
  4. Commit and push the changes

This action currently doesn't support reading the coverage data in GitHub Actions (but I opened a PR to implement this: #233). This means you currently need to include the whole table from above in your README.

Some actions that can help you implement this:

  • Generate a PR comment: thollander/actions-comment-pull-request@v2
  • Add, commit and push changes: EndBug/add-and-commit@v9

Edit: I published a fork of this action that provides the coverage data for GitHub actions to use. You can see how I use it here: https://github.com/ricardoboss/STEP/blob/main/.github/workflows/report.yml

ricardoboss avatar Dec 14 '23 09:12 ricardoboss

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this issue will be closed in 30 days.

github-actions[bot] avatar Mar 14 '24 01:03 github-actions[bot]