Creating a Repo on User's GitHub

I want to build a UI that uses a GitHub app that asks the user to login and then after they login, they press a button which creates a new repository in their GitHub. This new repo would be a copy (i.e. templated from a project I have in my personal repo). Think of it like the template feature from GitHub, but instead of working within GitHub, it’s through my UI where it is done externally.

I know that I would need to write access to code, read access to metadata/repository hooks, and read and write access to admin/checks

How would I create this?

I have a similar use case, and find that:

  • cannot use Github App to do this without All/Current repo access (which I do not want)
  • have to use OAUTH App for the user with repo scope to create a repo at which point I can send them to install the App and prefil the user account + repo selection to be just this one repo (they of course could change that and break the model)
  • I cannot find a good way to remove the temporary OAUTH app. I don’t want it activated at this point.
  • There is no Github App installation option for “only repos this app creates” which would be really useful.
  • I have to verify they did the correct action on App install and didn’t change anything significant, if so I have to revoke the install immediately and tell them they messed up.

So I have to either leave a dangling OAUTH app hanging out for the user, or have them create the blank repo and then install the App onto it, or just use OAUTH App for the whole thing.

Any other tips from the community?