#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

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

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.


Leave a comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: