but as soon as I merge a PR, It runs.
I expect /^$/ to match an empty string, so It shouldn’t until I push the new tag.
I’ve also tried the complementary statement:
tags:
only: /.*/
As I understand it, when using filters the branches expression is evaluated first and if it results in a true condition the job is run. The tag expression is only evaluated if the branches expression returns false.
Thanks for explaining. I had actually read something about precedence but I couldn’t interpret it correctly. I was assuming the two conditions were OR or AND.
The problem is the bit about “The tag expression is only evaluated if the branches expression returns false”. You have to do a branch check first to cause the tag check to take place.
It is not clear why this limitation was built into the scripting DSL, but it is unlikely CircleCI can make any changes to it unless they issue a new DSL version, something I’ve not seen any indication of happening, beyond a comment on the following message exchange
That message exchange also indicates a possible workaround, where you use a filter that always fires with a branch and tag check. This then causes both pipeline variables to be populated and so a job level ‘when’ condition should be possible.