Workflow status badge per branch

According to https://help.github.com/en/articles/configuring-a-workflow#adding-a-workflow-status-badge-to-your-repository it is possible to add a status badge for a workflow.

Currently the documentation does not mention whether it is possible to reference a branch name. This is important (and useful) for projects that have long-living branches in addition to the default branch.

For example, sebastianbergmann/phpunit has multiple long-living branches

master

8.3

7.5

As of the moment, when using Travis CI (see https://travis-ci.org), we can specify the name of the branch branch build status badges:

[![Build Status](https://travis-ci.org/sebastianbergmann/phpunit.svg?branch=master)](https://travis-ci.org/sebastianbergmann/phpunit)
[![Build Status](https://travis-ci.org/sebastianbergmann/phpunit.svg?branch=7.5)](https://travis-ci.org/sebastianbergmann/phpunit)
[![Build Status](https://travis-ci.org/sebastianbergmann/phpunit.svg?branch=8.3)](https://travis-ci.org/sebastianbergmann/phpunit)

It would be great if we could do the same with GitHub Action status badges, for example:

[![CI Status](https://github.com/sebastianbergmann/phpunit/workflows/CI/badge.svg?branch=master)](https://github.com/sebastianbergmann/phpunit/actions)
[![CI Status](https://github.com/sebastianbergmann/phpunit/workflows/CI/badge.svg?branch=8.3)](https://github.com/sebastianbergmann/phpunit/actions)
[![CI Status](https://github.com/sebastianbergmann/phpunit/workflows/CI/badge.svg?branch=7.5)](https://github.com/sebastianbergmann/phpunit/actions)

Is that possible?

12 Likes

Badges by branch currently aren’t available. They currently check the status on your default branch (usually master).

Definitely agree it’s important. It’s on our list to get this added. :sparkles:

1 Like

is this also why PR status badges don’t work? I’ve got a push badge and a PR badge and only the push one seems to be working.

Yes - this is correct.

Are there any news about badges by branch?

@vitoromaniello wrote:

Are there any news about badges by branch?

 

According to the documentation it should now be possible to add a “branch” query parameter to the URL to get a branch specific badge, so you’ll get something like:

![](https://github.com/user/repo/workflows/Tests/badge.svg?branch=develop)
1 Like