Github protected branch

I have setup my Github repo to use protected branch and turned on the settings that requires circleci status check. I found that whenever my Pull Request branch is having some missing commits from the master branch, Github does not allow me to merge my Pull Request branch to master even there’s no conflict at all. Is this the expected behavior that my Pull Request branch needs to be always “synced” with the master branch before merging?

This is a question you may have to ask GitHub.

CircleCi only tells Github if the build passes or fails, it is up to GitHub to decide if you can then merge or not.

Ref: https://help.github.com/articles/defining-the-mergeability-of-pull-requests/

1 Like

Thx @drazisil, I got a reply from Github and see if this can help other circleci users.

The behavior you observed is indeed expected. When required status
checks are enabled for a branch, pull request made to that branch have
an additional requirement – the source branch must be up to date with
the target branch (master in your case). This helps you feel more
confident that your tests will pass not only for your branch, but also
when you merge your branch into the target branch. If the source branch
is behind the target, that means there are some commits there that are
not in the source branch which might affect CI tests. For that reason,
the merge button will be disabled and you’ll be shown an Update branch
button which lets you merge the target branch into the source.

That said, the team is considering adding configuration options so that
you can decide if you want to turn on this requirement or not (but I
can’t promise if/when this might happen).

2 Likes

Thank you very much for sharing! :smile: