These instructions are for server-side setup and debugging of the dev-desktop github app. The user only needs to be directed to the app installation URL and everything should just work for them.
We're using the python github library for all github operations. You can find the docs at https://pygithub.readthedocs.io/en/latest/introduction.html
- Go to https://github.com/settings/apps
- New Github App
- Fill out metadata (name and url)
- disable WebHook checkbox
- Set
Contents - Repository contents, commits, branches, downloads, releases, and merges.
to read/write - Set
Workflows - Update GitHub Action workflow files.
to read/write - Set to "enable on any account"
- Create App
- Go to https://github.com/settings/apps/{your_app_name_here} and copy the
App ID
intoapp_id.txt
(same folder asgen_temp_access_token.py
)
- Go to https://github.com/settings/apps/{your_app_name_here}#private-key and generate a private key
- Download starts, save it to somewhere private.
- copy the .pem file into the same folder as the
gen_temp_access_token.py
and name itdev-desktop.private-key.pem
- direct the user to https://github.com/settings/apps/{your_app_name_here}/installations
- let them install it on the org/user they want to and restrict to the repositories they want to use
- invoke
gen_temp_access_token.py <github_username> <github_repository_name>
We're using credential-helpers. For debugging a credential helper, have it in userspace and invoke it with
git -c credential.helper -c credential.UseHttpPath=true /path/to/helper push origin branch
Note that this does not work for remotes that are registered with ssh urls. You must use https!
The first command line argument is get
, store
or remove
.
In our case, we just abort (exit(0)
) for everything but get
, as we regenerate credentials on every invocation anyway.
The actual arguments are passed via stdin and usually look like
protocol=https
host=github.com
path=your_repo.git