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: {
owner,
name
}
}
)
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.
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?