-
I am trying to figure out what the syntax would be for running a workflow, on push, on any branch but master. I read through some other posts here that looks like folks are having issues with the tag filtering, so maybe this is related? If I use code like:
This will throw the error:
Does anyone know the syntax I am looking for? Thank you in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 13 comments 2 replies
-
To answer my own question, the syntax appears to be:
Edit: This is not the correct implementation, and only appeared to work since I had different workflow files in the master and test branches. |
Beta Was this translation helpful? Give feedback.
-
I’ve found that putting quotes around !master works, but I’m not sure if it’s technically correct:
|
Beta Was this translation helpful? Give feedback.
-
We’ve been using this at the top of our
Hope that helps! Edit: The good news is that @arpanlaha 's solution works fine for me. |
Beta Was this translation helpful? Give feedback.
-
@arpanlaha- your solution works perfectly. Thank you so much for helping out! I will flag your code as the solution. |
Beta Was this translation helpful? Give feedback.
-
Leading bangs are reserved for custom tags in YAML. So you need to always use explicit strings. |
Beta Was this translation helpful? Give feedback.
-
You need quotes when the branch/tag starts with a ! or *. |
Beta Was this translation helpful? Give feedback.
-
Thank you @jeremyepling. I see that docs have been updated on https://help.github.com/en/articles/workflow-syntax-for-github-actions to reflect the same. |
Beta Was this translation helpful? Give feedback.
-
Does not seem to work for me. 😦 |
Beta Was this translation helpful? Give feedback.
-
Works perfectly! Thanks a lot. |
Beta Was this translation helpful? Give feedback.
-
For anyone where the solution is not working. This happened to me: I was pushing to a branch called ‘release/1.0.1’ and the wildcard ‘*’ does not seem to work for this naming. You also need to set ‘*/*’ to make this work. As described on https://golang.org/pkg/path/#Match ‘*’ :
|
Beta Was this translation helpful? Give feedback.
-
Similarly to the problem that @verbruggenalex highlighted, the double ** will work as well:
The documentation here states:
|
Beta Was this translation helpful? Give feedback.
-
Thanks for this, hopefully this can be marked as the solution instead of what I had previously. |
Beta Was this translation helpful? Give feedback.
-
Using
|
Beta Was this translation helpful? Give feedback.
I’ve found that putting quotes around !master works, but I’m not sure if it’s technically correct: