Workflow badge always "no status" when limited to branch=master

I have a test workflow enabled for all pushes and pull requests, but I want to limit the README status badge to the master branch, so I used the branch=master parameter:

https://github.com/zmwangx/miller-rabin/workflows/test/badge.svg?branch=master

However, the badge says “no status” although the head of master branch definitely had a successful test workflow run.

Limiting to another branch works:

https://github.com/zmwangx/miller-rabin/workflows/test/badge.svg?branch=github-actions

What’s going on?

Note that the head of the master branch is at the moment the same commit as the head of the github-actions branch, which was pushed to GitHub first, and then merged into the master branch. Maybe the same-commit-from-another-branch situation triggered a bug in the system?

The commit at question: https://github.com/zmwangx/miller-rabin/commit/198d65f02d3799786a51800888b7797e14989885

1 Like

I checked your workflow runs, all are triggered on github-actions branch. There is no one on master branch. So when use branch=master in badge, it will show no status.

I tested merge operation in my side. It always add another merge commit to master . How did you do to avoid this and merge github-actions branch commits directly to master?

Oh, thanks, I didn’t notice the branch tag next to each workflow.

In that case, I think the bug is the workflow was triggered from the github-actions branch when I pushed the commit to master branch.

I tested merge operation in my side. It always add another merge commit to master .

When the branch being merged is a direct descendant of the branch merged into, git simply fast forwards the head pointer, and no merge commit is created. Which is what happened here. Graphically:

A - B (master)
     \- C - D - E (github-actions)

Running git merge github-actions on master branch should fast-forward master to E, creating no merge commit. But then I pushed master to GitHub, triggering the test workflow with E; it should have triggered from master, but it was erroneously triggered from github-actions. Note that even the “build and publish distributions” workflow, limited to v* tags only, is shown as triggered from the github-actions branch; that’s pretty broken.

(Sorry about the poor formatting, the rich text editor is killing me.)

1 Like

Thank you for your detail explanation. I have reported this issue to the appropriate engineering team for further evaluation. Let’s wait for their response. 

1 Like