0

I am trying to create repo using GitHub CLI on a GitHub Action and it stuck on

GraphQL: Resource not accessible by integration (createRepository)

Here is the action.yaml

name: Create Repo
on: 
  push:
    branches: [ master ]

env:
  GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  TEMPLATE_REPO: template # this is the template directory

jobs:
  build:
    name: Create Repo
    runs-on: ubuntu-latest
    permissions: write-all
    steps:
    - name: Check out repository
      uses: actions/checkout@v3

    - name: Repo Create
      run: |
        git -C ${{ env.TEMPLATE_REPO }} init
        gh repo create repo-test --private --source=${{ env.TEMPLATE_REPO }}

Here is the error I am getting. What permission I need to provide. I am ORG admin

Initialized empty Git repository in /home/runner/work/repo-central/repo-central/template/.git/
GraphQL: Resource not accessible by integration (createRepository)
Error: Process completed with exit code 1.
Rio
  • 595
  • 1
  • 6
  • 27
  • Does this answer your question? ["Resource not accessible by integration" on github post /repos/{owner}/{repo}/actions/runners/registration-token API](https://stackoverflow.com/questions/70435286/resource-not-accessible-by-integration-on-github-post-repos-owner-repo-ac) – Fcmam5 Mar 22 '23 at 08:35

1 Answers1

1

Make sure you pass in a "Classic" Personal Access Token. The new fine grained access tokens don't support the GraphQL API yet.

jessehouwing
  • 106,458
  • 22
  • 256
  • 341