Authenticating Workflow

I have a workflow that runs a series of python files which ultimately create a couple of yml files to run workflows. (The workflow automates the process to create additional workflows). However, I get this error:

 ! [remote rejected] main -> main (refusing to allow a GitHub App to create or update workflow `.github/workflows/week1.yml` without `workflows` permission)

What should I add/change in the yaml file? I attempted authenticating using a PAT with the workflows permission enabled but still received the same error. Here is the original yaml file.

Hi, it looks like the problem is the job simply doesn’t use the PAT. actions/checkout configures the repository to use the GITHUB_TOKEN for authentication to GitHub. This is a local configuration, so it overrides the global setting the oleksiyrudenko/gha-git-credentials action (which I don’t think you need) should create.

You can provide another token to actions/checkout with the token parameter:

- uses: actions/checkout@v2
  with:
    token: '${{ secrets.MY_PAT }}'

That way actions/checkout will configure that token for further operations, including your push. You’ll still need to set user.name and user.email before committing the changes.