DEV Community

El Bruno for Microsoft Azure

Posted on • Originally published at elbruno.com on

#GitHub – How to display the status badge for a GitHub Action πŸŸ’πŸ”΄

Hi !

Last week I wrote 2 posts about

It’s a super cool feature ! 😁

GitHub Actions, are an important part of this series, and on the online event, I had this question:

How do I display the current status of the last run of an Action?

Lucky me, this one is an easy one. On the Actions section in GitHub, we select the workflow and we have the option to β€œCreate Status Badge”.

GitHub Action definition with Create Status badge option

We can generate the markdown code for this action.

Create Status Badge markdown<br>

The markdown is super simple, and if you want to also use this in other format, like HTML, you just need to add the sufix [/badge.svg] to the action .yml definition.

https://github.com/elbruno/AzureApiBadge/actions/workflows/azure-static-web-apps-victorious-wave-00360790f.yml/badge.svg
Enter fullscreen mode Exit fullscreen mode

So, once I added this to the Readme.md in my repo, I can see that the build action didn’t succeed.

badge in readme with an error

Let’s fix it ! I just need to add an entry HTML file to the Azure Static website, and now it works.

badge in readme succeeded

The sample repo is here: https://github.com/elbruno/AzureApiBadge/tree/master

Happy coding!

Greetings

El Bruno

More posts in my blog ElBruno.com.


Top comments (0)