-
Hello. I have a Workflow that I only want to run when a new tag is pushed to the repository. I have set the following “on” condition:
But my workflow is being executed also for branches. What I am missing? Thank you. |
Beta Was this translation helpful? Give feedback.
Replies: 19 comments 1 reply
-
+1 I’ve the same issue. It seems the tag filtering is not considered.
|
Beta Was this translation helpful? Give feedback.
-
When I try to use on: I get a syntax error, e.g.
gives me
This is in .github/main.workflow, right? |
Beta Was this translation helpful? Give feedback.
-
Ah so GitHub have changed the syntax to YML, I’ve used their migration tool to get it “working”. Well, for me this means that using the syntax above means that for every tag push, I get a failed build and a message saying No event triggers defined in on. |
Beta Was this translation helpful? Give feedback.
-
Hmmm, that’s super weird, somehow I got it working with the exact code from @provok . At first it wasn’t working for me, then I tried the exact code from GitHub’s workflow on syntax and specified an exact tag v1. This worked, then I changed back to @provok’s code and it started working. Not sure what it was. My steps now are: change some code, commit, push code. Change some new code, commit again and push. Then tag when I’m happy, push the tag. The latest commit will get the code build, but the first one will not, as expected. |
Beta Was this translation helpful? Give feedback.
-
Perhaps its because “create” also triggers when a branch is created, so it will run the filter on the first commit, then not until you actually create and push a new tag. @brokge can you confirm that when you created the branch the workflow did not get triggered by the “create” action? |
Beta Was this translation helpful? Give feedback.
-
It seems now that I cant even run workflows for tags: I have this:
But the workflow is not running at all when a new tag is pushed |
Beta Was this translation helpful? Give feedback.
-
None of this is working. This is triggered even when branches are created. The
This will never be triggered:
This will never be triggered either:
I’m creating tags with GitHub’s own “Create release” button. Can anyone document this feature? |
Beta Was this translation helpful? Give feedback.
-
In your second example, you need to quote the asterisk, that’s a YAML syntax requirement. This should work:
|
Beta Was this translation helpful? Give feedback.
-
Does the same apply to branches as well? Because this doesn’t work for me:
|
Beta Was this translation helpful? Give feedback.
-
It does apply to branches, but if your branch might include / then you need to match on that too (for as many levels as you may have - */*, */*/*, */*/*/* etc.) e.g.:
|
Beta Was this translation helpful? Give feedback.
-
The proposed solutuon doesnt seem to work for me. :
|
Beta Was this translation helpful? Give feedback.
-
The proposed solution doesn’t seem to work for me too 😕 . |
Beta Was this translation helpful? Give feedback.
-
I am sorry. It is indeed working for me. Thank you |
Beta Was this translation helpful? Give feedback.
-
@artalat Use two asterisks, that’ll match sub-paths:
|
Beta Was this translation helpful? Give feedback.
-
Hi @ethomson this solution appears to trigger when pushing to a new branch. eg. UPDATE: This problem appears to have be fixed on the GitHub side? |
Beta Was this translation helpful? Give feedback.
-
where this needs to be updated. I need to create trigger only when the tag is pushed/created in Github.any suggestion |
Beta Was this translation helpful? Give feedback.
-
The assembly by the tag does not work, then ci starts when creating the branch |
Beta Was this translation helpful? Give feedback.
-
Hi @ethomson What’s the recomended way to run a step (or even a job) based on a Git tag? The esiest way I found out is as follows:
Would be handy if I could do like this:
Best Wishes,
|
Beta Was this translation helpful? Give feedback.
-
Is there a way to run the workflow only when tags are created in upstream repository? I can not seeing anything in that regard in the docs. Or, is that supposed to be handled with an external action instead? |
Beta Was this translation helpful? Give feedback.
In your second example, you need to quote the asterisk, that’s a YAML syntax requirement. This should work: