5monkeys / cobertura-action

GitHub Action to report cobertura coverage
MIT License
58 stars 64 forks source link

Storing badge under the GitHub Action #41

Open baubakg opened 3 years ago

baubakg commented 3 years ago

Hi,

I would like to avoid storing badges in my repository code. Ideally I would like to store my badges un der the GitHub Action execution itself. This way I can reference it in the markdown.

<Path to my Repository>/actions/workflows/myGitHubActionFile.yml/jacoco.svg

Is there a workaround for this?

antonagestam commented 2 years ago

@baubakg If a simple green/red badge is what you're after, then the builtin Github Actions badges should work: https://docs.github.com/en/actions/monitoring-and-troubleshooting-workflows/adding-a-workflow-status-badge

Otherwise, if you want a badge with "burnt-in" coverage percentage, things are more complicated. I've had the idea of storing rendered badges in artifacts, but that doesn't work (at least trivially) because there's no predictable way to link to the latest artifacts of a workflow. You'd also have to deal with the problem of artifact retention.

So I think currently there's no straight-forward way to achieve this without involving a third-party host to associate coverage percentage with a branch/commit-ish.

leherv commented 1 year ago

I think a convenient way would be to provide output variables which then can be picked up by another action to create a gist which then can be used to create a badge. This would be the most flexible and least "intrusive" way imho.