Why does this action not cause an endless loop? #238
-
The workflow I've created is trigged on push. Because the git-auto-commit action (the final step of my workflow job) is pushing new files to my repository, I would expect it to cause an endless recursive loop of triggering the same workflow, as pushing causes a workflow that pushes, etc. I'm hoping someone can please explain why this doesn't happen in practice. I'm a bit of a newbie to GitHub Actions and workflows so I appreciate it in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Good question which isn't obvious if you're just getting started with Actions. To push the generated commit to GitHub, this Action uses the so called "GITHUB_TOKEN". The token is used to authenticate with GitHub's APIs and allows this Action to push a commit to your repository. When this Action pushes the commit to GitHub the GitHub basically built in a failsafe, so you don't accidentally trigger a loop and burn through your Action minutes. We've also mentioned this in the README here. (You can disable this protection by using your own access token) |
Beta Was this translation helpful? Give feedback.
Good question which isn't obvious if you're just getting started with Actions.
To push the generated commit to GitHub, this Action uses the so called "GITHUB_TOKEN". The token is used to authenticate with GitHub's APIs and allows this Action to push a commit to your repository.
When this Action pushes the commit to GitHub the
push
-event is triggered. However, if the event has been triggered with the GITHUB_TOKEN no further workflow run is triggered. Thus preventing an endless loop.GitHub basically built in a failsafe, so you don't accidentally trigger a loop and burn through your Action minutes.
We've also mentioned this in the README here. (You can disable this protection by using your …