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:
on: create: tags:
Solved! Solved! Go to Solution.
+1
I've the same issue. It seems the tag filtering is not considered.
on: create: tags: - v*
When I try to use on: I get a syntax error, e.g.
workflow "MyWorkflow" { on: create: tags: - v* resolves = ["MyAction"] }
gives me
unable to parse Line 2: illegal char
This is in .github/main.workflow, right?
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.
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.
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?
It seems now that I cant even run workflows for tags:
I have this:
on: push: tags: - '*'
But the workflow is not running at all when a new tag is pushed
@brpaz the code snippet you shared is for workflow
when a push happend on any tagged branch..
I don't think it will work for "when a new tag is created "
you code is similar to the sample code from here onpushpull_requesttagsbranches
None of this is working.
This is triggered even when branches are created. The `tags` part is just ignored:
on: create: tags: - *
This will never be triggered:
on: push: tags: - *
This will never be triggered either:
on: push: branches: - 'refs/tags/*'
I'm creating tags with GitHub's own "Create release" button.
Can anyone document this feature?