Consistent approach to GitHub Token retrieval in breeze/prek hooks
- Dominant language
- Python
- Stars
- 46.9k
- Forks
- 17.8k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 483
Description
The current workflow is confusing if you have bad GITHUB_TOKEN set with not enough scope
We likely should do a bit better job in retrieval of GITHUB_TOKEN and make it consistent - joining GITHUB_TOKEN usage with`gh auth token` retrieval.
That would likely be a better workflow that will handle a number of cases.
* remove GITHUB_TOKEN is set first, try gh auth token without it and only then fall-back to GITHUB_TOKEN. Generally `gh` auth access token has enough permissions to do anything.
* in all places where we retrieve token we should add scope
* we should add some check if the right permissions are set when we get it - like check if GITHUB_TOKEN has the right scopes - and give better error message including the URL to create a good token
* we should likely use the "new" token permission (not classic). Github recently added pre-filling to the new tokens here https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#pre-filling-fine-grained-personal-access-token-details-using-url-parameters and we should use this one rather than 'classic" pre-filling
Contributor guide
Assessment
This issue has not been assessed yet.