Filters branches ignore stops workflow at all branches

Hi, I try to set config.yml to not start checks on GH on branch “staging”. I add to config.yml this:

workflows:
  sample: 
    jobs:
      - build
          filters:
            branches:
              ignore: staging

So it stops run wokrflow on staging branch as expected, but also didn’t run build job on PR on other branches as master or production.

If that is a copy and paste from your config.yml the first thing to try will be to use “- build:” rather than “- build”.

Without the “:” in place, the processing of the config file can cause odd results.

If that is not the issue can you post more of your workflows?

1 Like

This was problem with runing workflow, but now also on staging branch it runs, so still need to exclude somehow check on it.

workflows:
  sample: 
    jobs:
      - build:
          filters:
            branches:
              ignore: staging

On clear “staging” branch it works, but on staging is also commits on branch like “branch_name(#123) + staging”, so probably I need to use tags now

You can use a regex expression, so with a bit of work you can ignore any branch that contains the word staging. I do not use regex often so I’m not the best person to say what expression you should use.

If you do look at using tags be aware that you need to use the following structure for your filter

    filters:
      tags:
        only: 
          - /^[vV].[0-9]+.*/ 
          - /^[0-9a-zA-Z]+.*/
      branches:
        ignore: /.*/

The braches/ignore part is required to allow the tag based filter to work. The regex in the tag filter is just an example from one of my environments.

1 Like