arsdever
arsdever

Reputation: 1262

Github actions and badges show percentage data

I have read about the way to create and add a custom workflow badge which will show whether the workflow passes or fails. But here's a question. Is it possible to output some percentage data on the badge and how to output this data?

Upvotes: 7

Views: 2858

Answers (2)

arsdever
arsdever

Reputation: 1262

Recently, I have seen a way of achieving that, but it's a bit like cheating. All you need is to configure a github action dumping the data you want into your gist in a format that the badge service (e.g. shields) supports. and then use the service to provide a badge based on your gist content.

Upvotes: 1

Arne
Arne

Reputation: 20127

At the time of writing, there is no badge provided by github to show amount of code coverage, which is the most popular percentage-showing badge. Other CI/CD frameworks usually provide such a badge, most notably and comparably gitlab, and it is very likely that something like that will arrive at some point in the ongoing github actions beta.

If you can't wait that long, one other option you have is to use an external badge service. A very popular one that contains a wide range of coverage badges is shields.io, they might already support the toolchain you're using.

If that is not the case, you can also request a github actions coverage badge from them or even implement it yourself.

Upvotes: 6

Related Questions