Say I have workflow1 & workflow2. If pushes to any branch trigger workflow1 & tags trigger workflow2, how can i prevent both workflow1 & workflow2 to be triggered when I push a branch with tags?
Example:
$ git commit --allow-empty -m “Dummy commit”
$ git tag -a 1.0.0 -m ‘nothing here’
$ git push --tags origin master // triggers both workflows
I don’t want the above to trigger both workflows. I just want workflow2.
Hi @Aurelius,
the trigger items are processed in the order you define it, so define the tag related item before the push related item.
@Aurelius my previous message was not correct. In your case you push a commit and also a tag, so you fire two git events (tag and push).
If you would just add a tag to a commit then, you would only fire a tag event.
Example:
$ git tag -a 1.0.0 -m ‘nothing here’
$ git push --tags origin master // triggers only tag
1 Like
Or to push just a specific tag, instead of all tags (git push --tags
will push all local tags to the remote):
git push origin : TAG
Example:
git push origin : 1.0.0
This pushes only the 1.0.0
to the remote named origin
(the default remote).
One more note: your git push will trigger both a Push and a Tag because you use annotated tags (git tag -a
). An annotated tag is actually a git commit + tag, so the push counts as both (GitHub will send two separate webhooks, one for a push and one for the tag).
A non annotated tag does not generate a commit, so it will not trigger a “Commit/Push” event.
E.g.
git tag 1.0.0
git push origin : 1.0.0
will only trigger a Tag event.
I hope this helps, if you have any questions just let us know!