How to trigger action for tag on old commit #25963
-
So I have a repository, and I want to tag an old version of it (i.e. not the most recent commit). I have a workflow that is activated when a tag is pushed:
I tried creating a new tag in GitHub for a recent version that not the most recent version, and it did not trigger this action. I also tried using Why is that and how can I trigger the action no matter if the tagged commit is the most recent or not? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Hi @dmfrodrigues, Glad to see you in Github Community Forum! This is by designed. When you tag old commit and push to repository, github will check if event trigger exists on the workflow yaml “AT THE COMMIT”, while not the latest workflow yaml file. You can checkout the files based on My workflow for your reference. It’s not supported to always trigger actions no matter old/recent commit is tagged. Hope it’s clear and helpful! |
Beta Was this translation helpful? Give feedback.
-
I see. So the workflow is only triggered if the commit being tagged has the workflow yml file for tags, right? Please just confirm I understood it right, so I can set it as solution. Thanks. |
Beta Was this translation helpful? Give feedback.
-
Yes, it’s correct!@dmfrodrigues The github.ref is the updated ref, if you tag on old commit and push to repository, it will check the yaml file till the commit, trigger the workflow if the tag trigger exists. Thanks. |
Beta Was this translation helpful? Give feedback.
Hi @dmfrodrigues,
Glad to see you in Github Community Forum!
This is by designed. When you tag old commit and push to repository, github will check if event trigger exists on the workflow yaml “AT THE COMMIT”, while not the latest workflow yaml file.
You can checkout the files based on
the old commit
, if there’s already tag trigger(on: push: tags) on the workflow yaml, tag on this commit, the workflow will be triggered. If no tag trigger, workflow will not be triggered.My workflow for your reference.
It’s not supported to always trigger actions no matter old/recent commit is tagged.
Hope it’s clear and helpful!