Cannot ignore master branch for builds

I know that we can enable builds to run for PRs only. We have that turned on.

I also know that we can add branch whitelists and blacklists. Our setting is currently the following:
general: branches: ignore: - staging - /releases/.*/

This works somewhat. When we PR from a feature branch to staging, only feature branch is built. The staging branch is ignored.

But when we merge directly from staging to master, master always builds (even though we set the setting to run builds for PRs only).

Ideally, we want to pass green builds at staging only. After that since staging and master are nearly identical, we just merge directly from staging to master knowing that it should be green also without actually running the build.

Anybody know how to ignore master branch, either when PR is not used, or completely?

Hi there,

There is no way to ignore the master branch. However, you could add a section to your build that checks the current branch and exits the build – its kind of a hack but depending on what you are trying to do this may be the best approach.

You could change your master branch to be the staging branch. Then fork the repo and do merges across forks. The new repo won’t automatically be built by CircleCI, and you could leave it like that.