What is the best suggestion for Github Action badge?

Hi guys,

I am starting to replace my old CI system, Travis, with the new Github Action system.

It looks pretty promising for now with only one flaw.

How should we set up the link for Github badge on the readme page?

There are two problems that I can see

  • Github Action log pages are per-job based instead of per-workflow instance-based. To make it more clear, if we look at this page, https://github.com/JiayinCao/SORT/runs/366500828, there is no way to pick the instance of the workflow itself, but only the job in it. However, the badge is per workflow-based, meaning each workflow has its own badge, but not the jobs in it. The granularity doesn’t match, meaning there is no way to properly set up the link of the badge.
  • For people, who is not logged in, there is no Action tab in Github. The link like this, https://github.com/JiayinCao/SORT/actions?query=workflow%3A%22Build+SORT%22, will result in 404 page. Other platforms like Travis, appveyor, provide a link that automatically links to the latest instance of building process.

Any suggestion is welcome.

Thanks

Jiayin

Hey @jiayincao you can check https://actions-badge.atrox.dev/ it will help you generate a badge fast.

Thanks for sharing, it helps.

But unfortunately, it doesn’t solve all the problems. The link automatically picks one of my jobs every time I try it, there is no perfect job to pick because the first problem I mentioned.

And the other problem is, in my case, I have a filter to avoid triggering Github Action on push on certain files. If I push those files, the link will fail due to the lack of latest action and it results in this single line page.

{"schemaVersion":1,"label":"GitHub Actions","message":"no runs","color":"inactive","isError":true,"namedLogo":"github","cacheSeconds":300}

I believe this could be a corner case not covered by the algorithm,  it would be great if it could get handled.

Thanks

Jiayin

From what I know, yes, the badge will always be based on your workflow not for each job, so this:

https://github.com/JiayinCao/SORT/workflows/Build%20SORT/badge.svg

Will show the result of the “Build Sort” workflow, including all OSs, and if you want to have one per job, you should define each job in each own workflow (the limit is 20 workflow if I am not mistaken).

For the filter issue, can you try the link above and see if it will work as this one is direct from Github no external script is used.

  1. If you click the workflow run in ‘action’ tab, the default page is testsuite link, it’s the workflow link.

Github actions support badge and usage is documented here. Currently it’s not support to get badge for each job in a workflow.


2. Thanks for your suggestion. Due to security restrictions currently there’s no plan on showing the Actions tab, filters page or the logs to an anonymous user. There is no timeline to change that.
3. Could you please share the detail link in your first comment?  Since the files are excluded, push those files will not trigger the workflow. What kind of filter did you use in your badge link?