Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Official badge for GitHub actions

Does GitHub have an official 'badge' for their new 'actions' feature?

I came across this request on their official repo and there seems to be an official one:

https://github.com/{github_id}/{repository}/workflows/{workflow_name}/badge.svg 

as per this comment, but I am unable to get it to work. Is it actually working? When I use it, I get the below output:

Unrendered GitHub badge

Note that I have replaced {github_id} with my username, {repository} with my repo name and {workflow_name} with the corresponding workflow name (removing the curly braces). Does anyone else have this issue?
Edit: I am working on a private repo, in case it makes a difference.

like image 954
J. Doe Avatar asked Aug 30 '19 02:08

J. Doe


People also ask

How do I get my GitHub badge?

If you're a registered member of the GitHub Developer Program, building an app with the GitHub API, you'll get a Developer Program Member badge on your profile. For more information on the GitHub Developer Program, see GitHub Developer. If you use GitHub Pro you'll get a PRO badge on your profile.

What are the badges in GitHub?

GitHub Badges can boost the readability of the GitHub repositories because they provide users with a fast way to capture repository metrics. Badges are supposed to be embedded in your README.md which elucidates the importance and necessity of your project to other developers.


2 Answers

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) 
like image 55
Madhu Bhat Avatar answered Sep 19 '22 17:09

Madhu Bhat


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!

like image 22
J. Doe Avatar answered Sep 22 '22 17:09

J. Doe