Workflow infinite loop

Hi all!

I’ve found by chance a potential issue on GitHub workflows. Basically if an action performs a commit in the same repo using a Personal Access Token, then the workflow will be triggered again, again, and again… endlessly.

I made a demo here: https://github.com/leogr/workflow-loop

(ofc I stopped it after a while).

I’ve searched around to check if someone is already aware about this, but I found nothing.

BTW, what’s the right repo to open this kind of issue? 

1 Like

This is why we provide workflows with the GITHUB_TOKEN variable.  It is explicitly configured to  not run subsequent workflows to avoid this sort of behavior.  If you had used GITHUB_TOKEN here, you should not have seen a loop.

Using a personal access token avoids this check, and will allow you to get into infinite loops if you’re not careful.  So this is by-design but it looks like we should clarify this in the documentation - thanks for reporting this!

4 Likes

Yes, that’s exactly what I guessed too.
But I did not found any clear info into the docs.

Side issue: GITHUB_TOKEN has some limitation that PAT does not have (like GitHub pages are not updated, or you cannot interact with other repo)

You can avoid a loop as described in this answer, by adding an if condition to the job e.g. 

if: github.actor != 'my_account'
1 Like

What is My Account here? Can you please elaborate?