Create repo from template repo using a GIthub APP

I’ve trying to create a new repo from a template with my github app credentials, but even though I have administration permissions granted with the app, I’m getting the infamous Resource not accessible by integration response.

Code snippet for the request:

const res = await request(
        `POST /repos/carmon/til-template/generate`,
          headers: {
            accept: 'application/vnd.github.baptiste-preview+json', // needed while endpoint is still in preview
            authorization: `bearer ${botToken}`
          data: {

That botToken is an access_token made with an installation id.

Maybe this is not implemented for github apps ATM, so I’m just passing to check that.
Thanks in advance.

1 Like

Hi there @carmon :wave:

Thanks so much for joining the Community, and for your post!

When you suggested, that:

Maybe this is not implemented for github apps

…you were spot-on.

Currently, GitHub Apps can’t use the template endpoint, as you can with a PAT, or as an OAuth App. For this, I’d highly recommend submitting your request via our feedback form:

…for review and consideration.

In the meantime, is authenticating as an OAuth app, an option for you?

You might have security concerns around this though, so maybe this doesn’t work for your use case.

1 Like

Thank you very much for the reply!

I’ll submit the feedback and try the oauth app authentication method :slightly_smiling_face:

1 Like

Any evolution on this?

I’m creating an tool to create repos from a template. It’s a server-to-server mode and I would like to avoid to use a PAT for this.

Any ETA to add the repos/{user}/{repo}/generate endpoint for GitHub App?
It’s still not available according to Endpoints available for GitHub Apps - GitHub Docs and my tests.

I take back what I said.
Was just missing the “Repository > Contents” permission.
With this permission, the repos/{user}/{repo}/generate endpoint for GitHub App works perfectly.

Was a request created for this? The repos/{user}/{repo}/generate endpoint kind of works for Apps but if the organization or user hasn’t installed the app for all repos, it results in a “Could not clone: template repository not found.” error. If the user or org has allowed access to all repos, it seems to work just fine with Github Apps. Is this intended? @zigarn do you see the same behavior?

@nethgato any thoughts?