How to limit pipeline or workflow only on 1 branch? Or, how to prevent pipeline from be called on branch without config.yml?

I have a repo with test as default branch, and I want to make circleci start build only on that branch. That means, when I push to any other branch, no pipeline should be runned. (At most times, the other branches won’t have .circleci/config.yml.)

I added those to my .circleci/config.yml as described in https://support.circleci.com/hc/en-us/articles/115015953868-Filter-workflows-by-branch-

workflows:
  build-workflow:
    jobs:
      - build:
          filters:
            branches:
              only: test

But when I push to an other branch without those config, a build is still triggered and errored.

:grimacing: Still waiting for answer. I thought it is a easy question…

Hi @mercury233 ,

Thank you for sharing your question with us!

This error will appear if a config.yml file is not present for any branches regardless if a filter is set or not.

A way to resolve this error would be to pull in the config.yml file from your default branch, or create a dummy config like the following in every branch you wish to not build on CircleCI:

workflows:
  build-workflow:
    jobs:
      - build:
          filters:
            branches:
              ignore: /.*/

The result of this change would be that you would no longer see any “failed” workflows, but would start to see “no workflows” like what happens when a tagged build is not executed.

Please let me know if you have any additional questions or concerns regarding this.

Best Regards

I had this in my default branch:

But the problem still exists:
https://app.circleci.com/pipelines/github/mercury233/ygopro/57/workflows/f2fddca0-4652-4f30-88cc-278aecafa690/jobs/32

:innocent: Still waiting for answer.

:innocent: Still waiting for answer.

:innocent: Still still waiting for answer.

Hi @mercury233,

My apologies if my previous message was not clear. Could you confirm if the branches you are seeing the error for also have a config.yml file? I believe the error will show if it does not find a config.yml file in the branch that triggered the build.

Best Regards

Them don’t have config.yml, and my question is

how to prevent pipeline from be called on branch without config.yml?

1 Like

Hi mercury233, same problem here. Any solution?

Nothing except place mails from circleci to spam :innocent: