Push from Action does not trigger subsequent action #25702
-
I have an github action which sometimes pushes back to the repository, and I expect this push to trigger another action which configured with “on: push”, however this seems to not work. Is this intentional? Sample repository to demonstate the issue: https://github.com/Stummi/workflow-playground/tree/master/.github/workflows |
Beta Was this translation helpful? Give feedback.
Replies: 17 comments 16 replies
-
Hi Stummi, Glad to hear you in GitHub Community! If an action pushes code using the repository’s GITHUB_TOKEN, a new workflow will not run even when the repository contains a workflow configured to run when push events occur. Please create a personal access token in repo setting(write permission accordingly), replace GITHUB_TOKEN in your ‘inc-counter.yml’, code as below, thanks.
|
Beta Was this translation helpful? Give feedback.
-
This helped. Thank you! |
Beta Was this translation helpful? Give feedback.
-
Is there a plan for removing this limitation? Providing a personal access token grants the Action far greater privileges than it needs. |
Beta Was this translation helpful? Give feedback.
-
I’m using this same workflow with a second one triggered on pull_request. Even if I use a PAT my pull_request workflow doesn’t run when commits are pushed back to the PR branch. This is an example of my workflow https://gist.github.com/xt0rted/d0eac04e15a7cea80aa974a4448defef |
Beta Was this translation helpful? Give feedback.
-
The comments at https://github.uint.cloudmunity/t5/GitHub-Actions/Push-from-action-even-with-PAT-does-not-trigger-action/m-p/46293/highlight/true#M6505 solved my issue. I needed to add persist-credentials: false to my checkout step since it’s using v2. |
Beta Was this translation helpful? Give feedback.
-
This has been driving me CrAzY because it’s not intuitive and hard to find information about. Thank you for the workaround. |
Beta Was this translation helpful? Give feedback.
-
it took me hours to find this post. |
Beta Was this translation helpful? Give feedback.
-
Shouldn’t adding one of these permissions (Workflow syntax for GitHub Actions - GitHub Docs) to the |
Beta Was this translation helpful? Give feedback.
-
You can set |
Beta Was this translation helpful? Give feedback.
-
I know this is a fairly old discussion, but I think it'd be handy to be able to get a PAT for the user who initiated the action (for actions that are triggered via the workflow_dispatch event). Seems like this would provide a better audit trail than a static personal access token of like a "service account". |
Beta Was this translation helpful? Give feedback.
-
I'm not sure my configuration is exactly the same as the accepted answer, but I just wanted to post that I created an multi-job workflow that bumped and committed a package.json version number and with concurrency rules, it canceled the current workflow and started up a new one. It did this 3 times until I manually stopped the workflow. |
Beta Was this translation helpful? Give feedback.
-
Thank you, it took me several hours to find the issue~ |
Beta Was this translation helpful? Give feedback.
-
This is a big issue in our flow, I need to pull my trunk branch into feature branches in my CI/CD if there are changes there, but the pipeline doesn't get triggered because of this. There can be changes in my trunk branch which when merged into feature branch can fail the build, but the pipeline wont get triggered, also using PAT is not the best of options, I want to use default token rather than creating a token and making sure it doesn't expire, securing it, etc |
Beta Was this translation helpful? Give feedback.
-
I have also spent some time debugging this issue. I think GitHub will not allow triggering such workflows to prevent building recursive triggering of actions. The workaround is to use a PAT with the fitting permissions. I have also found this in the documentation s.
s. https://docs.github.com/en/actions/security-guides/automatic-token-authentication |
Beta Was this translation helpful? Give feedback.
-
As an alternative: If you want an action to run after another action, you can also use the Example
How I updated my actions |
Beta Was this translation helpful? Give feedback.
-
I have stumbled on Here is one example of that workflow in the wild 🙂 |
Beta Was this translation helpful? Give feedback.
-
I don't consider this issue solved. Creating manual PATs for every repo is very tedious and not scalable. Surely a flag that overrides the default behavior to not trigger on_push workflows can't be unreasonably hard to add. |
Beta Was this translation helpful? Give feedback.
Hi Stummi,
Glad to hear you in GitHub Community!
If an action pushes code using the repository’s GITHUB_TOKEN, a new workflow will not run even when the repository contains a workflow configured to run when push events occur.
Please create a personal access token in repo setting(write permission accordingly), replace GITHUB_TOKEN in your ‘inc-counter.yml’, code as below, thanks.