Skip to content

Trigger job on tag push only #25692

Answered by BrightRan
msafi asked this question in Actions
Apr 9, 2020 · 7 comments · 6 replies
Discussion options

You must be logged in to vote

@msafi ,

Creating/pushing a new tag to the repository is a type of Push event. By default, both pushing commits and pushing tags will trigger workflow run for, if you don’t set branches filter and tags filter for the Push event. More details you can reference here.

When the wokflow run is triggered by pushing tag, the github.ref is the full name of the pushed tag ( refs/tags/<tag> ).
So if you want to check if the workflow is triggered by pushing tag, you can try using the following if conditional for the job.

if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')

Related docs:

github context

Functions

Replies: 7 comments 6 replies

Comment options

You must be logged in to vote
1 reply
@JacobBrackett
Comment options

Answer selected
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
5 replies
@le91688
Comment options

@justinmchase
Comment options

@TheButlah
Comment options

@justinmchase
Comment options

@DEVigodE
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment