Official badge for GitHub actions

You can get the actions badge by navigating to the required workflow on your repo on GitHub.com and clicking on the Create status badge button.

enter image description here

Here, you can select the badge for the required branch and event and use the generated markdown.

For eg, below is the badge that I generated for master branch for push event of the CI workflow:

CI

The markdown for the above badge:

![CI](https://github.com/kratostaine/spring-authorization-server/workflows/CI/badge.svg?branch=master&event=push)

Worked for me:

[GITHUB-BADGE](https://github.com/{username}/{repository}/workflows/{name}/badge.svg)

GITHUB-BADGE

More info here: Adding a workflow status badge to your repository


I ran into another related problem of the name of the workflow containing spaces. These have to use URI escapes:

From main.yml

name: Hello World

Has to use a URI formatted like this:

https://github.com/{username}/{repository}/workflows/Hello%20World/badge.svg

This is not the right answer to the exact problem described here, but it is an alternative remedy to a problem demonstrating the same diagnostics - so I hope it helps somebody.


As it turns out, badge update/rendering is a slow process. After adding the badge to my README.md, I just started off with work in another branch. After about 10 minutes (at least in my case), the badge appeared but the pipeline status was shown as 'unknown'. It updated again after about 10 minutes and with the correct pipeline status ('passing' in my case).

So, once you are done, just continue with your other stuff and it will update on its own, in sometime. Hope this helps someone!