Build statuses are not per branch in github

Description:

When you push code to branch X to github, then travis will make a build of branch X. Lets assume that build failed. You can see that the build failed next to the commit in github for branch X.

If you then push the same code to another branch Y, then travis will make a build of branch Y. Lets assume that build succeeded. You can see that the build succeeded next to the commit in github for branch Y.

However what is unexpected is that if you now go see branch X, the same commit is now showing success instead of failure.
This seems to indicate that the build status of commits is shared at least between all branches. It seems that the status is not shared with other repositories, which is good.

Example:

I made a repository which fails the travis build when the branch is master and succeeds on any other branch:

Travis built the master branch and failed as expected: https://i.imgur.com/a2XWuVJ.png
Then I made a new branch from the master branch called succeed, which travis then built successfully as expected: https://i.imgur.com/Bncvupl.png
Then I went back to see the master branch, which now showed success, even though it really failed: https://i.imgur.com/jKcSaGh.png

The travis builds can be seen here: https://travis-ci.com/Rochet2/travisstatusbranchtest/branches
https://i.imgur.com/BDjRm1R.png
It clearly shows that the lastest build for same commit failed for master and succeeded for succeed branch.
However if you go to the actual branches in github you can see that both show success:
https://github.com/Rochet2/travisstatusbranchtest/commits/master
https://github.com/Rochet2/travisstatusbranchtest/commits/succeed

I would expect master to show failed status regardless of other branches.
The statuses can be different if the travis script has conditions, or even if for example network connectivity or similar happens to fail during one of the builds.

You are right, when you say that “Build statuses are not per branch in GitHub.”

I think this is a limitation on GitHub’s API.

Check Suite that we create only allows us to specify the commit SHA:


not a branch.

When GitHub displays the Check Suite status in the branch history view, it is choosing one that is available.

Coincidentally, there may be a bug in GitHub’s API, where only one Check Suite is retained when multiple Check Runs are created for a single SHA (as was illustrated by your test case). I will ask GitHub about that.

Imprint