gh-repo-stats icon indicating copy to clipboard operation
gh-repo-stats copied to clipboard

Enhance extension to leverage `gh auth` session

Open andyfeller opened this issue 2 years ago • 2 comments

Problem

One of the helpful aspects of GitHub CLI extensions is their ability to delegate authorization issues to be handled by gh auth. This allows interpreted and precompiled extensions to delegate this responsibility, focusing on the core functionality.

With initially running the gh-repo-stats extension, it prompted and required a personal access token (PAT) when this was already setup via standard GH CLI methods.

$ gh repo-stats --org $(whoami) 

######################################################
######################################################
############# GitHub repo list and sizer #############
######################################################
######################################################


------------------------------------------------------
Please create a GitHub Personal Access Token used to gather
information from your Organization, with a scope of 'repo',
followed by [ENTER]:
(note: your input will NOT be displayed)

Request

It would be nice if the extension was enhanced in a way where it did not need my PAT explicitly. Looking at the underlying interpreted script, I think this might be doable if all of the curl calls were instead leveraging gh api or other gh subcommands itself.

andyfeller avatar Jun 01 '22 19:06 andyfeller