'Github actions workflows are canceled right away

I have a problem with running github actions on branches created automatically from within other action. Config file triggers them on push to branches that start with feature-.

Then I have a python script using PyGithub and create_git_ref for branch creation. Everything works fine if I do it from local terminal, branch is created and actions are triggered properly, things change when the same script is launched from within github action using GITHUB_TOKEN as an authorization, then those actions are canceled even before they start, anyone experienced such a problem before? What am I missing?



Solution 1:[1]

The GITHUB_TOKEN has a specific scope os permissions, and it doesn't have the one(s) you need here.

Instead, you need to use a Personal Access Token and add it as a secret (for example ACCESS_TOKEN as you can't use the GITHUB_ prefix) and call it in your workflow using ${{ secrets.ACCESS_TOKEN }}.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 GuiFalourd