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:
on: push: branches: - '*' - !master
This will throw the error:
### ERRORED 14:48:42Z - Your workflow file was invalid: .github/workflows/main.yml: Unexpected tag '!master'
Does anyone know the syntax I am looking for?
Thank you in advance!
Solved! Solved! Go to Solution.
To answer my own question, the syntax appears to be:
on: push: branches: - /refs/heads/* - !master
Edit: This is not the correct implementation, and only appeared to work since I had different workflow files in the master and test branches.
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.
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 '*' :
matches any sequence of non-/ characters