New tag does not trigger an event #25973
-
I would like to trigger a new action after creating a new tag in a PR close & merge action: So, step 1: PR close & merge that creates a tag and pushes it to master successfully:
Step 2 (version a): When a new tag is pushed, initiate an event
Step 2 (version b): When a new tag is created, initiate an event
Even though I have tried both approaches an event is not triggered. Please help. Note: When I do manually |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
Glad to see you in Github Community Forum! This is due to events triggered by the ‘actions/checkout’ will persist GITHUB_TOKEN for latter git operations, hence the tag is pushed with GITHUB_TOKEN. You can add “persist-crendetials: false” to avoid this.
You can create a secret wih Personal Access Token and use it to push a tag. I tried to use rest api to create a tag, code sample as below, it use PAT and can trigger workflow.
Thanks |
Beta Was this translation helpful? Give feedback.
-
@weide-zhou thanks for the reply, but whenever I try to do this with the rest api call that you suggested, I am faced with this (even though I used a PAT from an admin user with all scopes enabled):
What am I missing here? |
Beta Was this translation helpful? Give feedback.
-
Thanks for your reply! What’s your code? Is there any typo? My workflow for your reference: It’s just a sample code which use PAT token, you can change it with your case. Thanks |
Beta Was this translation helpful? Give feedback.
-
Thank you @weide-zhou ! There were permissions missing for the call. |
Beta Was this translation helpful? Give feedback.
Hi @ivanovaleksandar,
Glad to see you in Github Community Forum!
This is due to events triggered by the
GITHUB_TOKEN
will not create a new workflow run. It’s mentioned in the official doc here.‘actions/checkout’ will persist GITHUB_TOKEN for latter git operations, hence the tag is pushed with GITHUB_TOKEN. You can add “persist-crendetials: false” to avoid this.
You can create a secret wih Personal Access Token and use it to push a tag.
I tried to use rest api to create a tag, code sample as below, it use PAT and can trigger workflow.