Filter by both branch and tag match

Hi All!

I’m trying to get a job running when I push a tag, but I want it to run if the branch is main only. What would be the best way to achieve that? Using both branch and tags filter at the same time does not seem to work.

Cheers,
A.

Hi @DroneKid ,

One way you could do something like this is by using a tag filter with a logic statement for branch filtering.

You could also use a logic statement to conditionally trigger a workflow if the tag and branch conditions are met with a config that looks something like :

workflows:
  my-workflow:
      when:
        and:
          - equal: [ main, << pipeline.git.branch >> ]
          - << pipeline.git.tag >> 

I hope that clarifies things. Let me know if any other questions come up. Cheers!