I have a GitHub workflow which has On Push to a branch trigger. This workflow also creates a tag and hence requires a push again. But I don’t want the workflow to run when a tag is created. How to achieve this? Please help.
The documentation says this:
If you define only
branches, the workflow won’t run for events affecting the undefined Git ref.
As I understand it (and have seen where I use branch filters) setting a
branches filter means that the workflow won’t run for tags unless you also have
Also, a push using the
GITHUB_TOKEN won’t trigger additional workflows anyway.
Thank you very much for your prompt response. So, if I try with the below syntax, it should take care of my requirement, right?
on: # Triggers the workflow on push or pull request events but only for the main branch push: branches: [ My-Branch ] tags-ignore: - '*.*'
Just this should be enough actually, unless you want your workflow to run for tags without a dot in them:
on: push: branches: [ My-Branch ]
Thanks a lot. Actually, my workflow should run on a Branch Push. However, adding a tag also requires a Push. Hence I was worried that it would create a loop for the workflow. (Workflow would run on Branch Push, but tagging would also need a Push and hence the workflow would run in an infinite loop).