github-actions bot labeling trigger's not the issue labeled event #25565
-
I have created an action that add labels to an issue, if a specific word is present in a commit message. Something like closing an issue from the commit message. But I found out that after the github-actions bot add the label to the issue the workflow who starts on labeling an issue did not trigger. I don’t know if this is intended or it is a bug, but I would like to know this. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
Hi korti11, This is an expected behavior. There is a limitation of workflow: An action in a workflow run can’t trigger a new workflow run. You can see this prompt in https://help.github.com/en/actions/automating-your-workflow-with-github-actions/events-that-trigger-workflows#about-workflow-events. When you use GITHUB_TOKEN in your actions, all of the interactions with the repository are on behalf of the Github-actions bot. The operations act by Github-actions bot cannot trigger a new workflow. I would suggest you use your own PAT when add labels to an issue. Store your PAT in secrets and use ${{ secrets.PAT } in your actions. Then you can see it is you who added a label in the issue. This will trigger the other workflow which is configured: on: issues: types: [labeled] |
Beta Was this translation helpful? Give feedback.
-
Thank you very much. That worked perfectly. |
Beta Was this translation helpful? Give feedback.
-
Seems like this solution does not work for Pull requests:
When I create a label manually it triggers. For label created with https://github.com/actions/labeler it does not. |
Beta Was this translation helpful? Give feedback.
-
ya it helped for me, thank you |
Beta Was this translation helpful? Give feedback.
Hi korti11,
This is an expected behavior. There is a limitation of workflow: An action in a workflow run can’t trigger a new workflow run. You can see this prompt in https://help.github.com/en/actions/automating-your-workflow-with-github-actions/events-that-trigger-workflows#about-workflow-events.
When you use GITHUB_TOKEN in your actions, all of the interactions with the repository are on behalf of the Github-actions bot. The operations act by Github-actions bot
cannot trigger a new workflow.
I would suggest you use your own PAT when add labels to an issue.
Store your PAT in secrets and use ${{ secrets.PAT } in your actions.
Then you can see it is you who added a label in the issue. Thi…