Can't restrict build to master-only

Using a CircleCI 2.0 yaml file, and not using workflows (at least I don’t think I’m using them, the string ‘workflow’ does not appear anywhere in my config.yml file, and there is no other file in the .circleci directory), I am not able to restrict the build to the master branch only, using the instructions in the documentation.

If I add the following:

build:
  branches:
    only:
      - master    

under the “jobs” key, it stops building ALL branches, including master.
Without that, it builds all branches.

How do I build on master only?

It could be a bug, see here. The solution in that case was to use the workflows device and put the filter there instead.

1 Like

That did the trick. Thanks.

2 Likes

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.