Showing results for 
Search instead for 
Did you mean: 
Copilot Lvl 2
Message 1 of 4

Workflow infinite loop

Solved! Go to Solution.

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:

(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? 

3 Replies
GitHub Staff
Message 2 of 4

Re: Workflow infinite loop

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!

Copilot Lvl 2
Message 3 of 4

Re: Workflow infinite loop

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)

Pilot Lvl 1
Message 4 of 4

Re: Workflow infinite loop

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

if: != 'my_account'