FociSolutions / github-foundations

A framework for managing your GitHub Enterprise account infrastructure.
MIT License
10 stars 1 forks source link

(feat): Assessment report tool #89

Closed TylerMizuyabu closed 5 months ago

TylerMizuyabu commented 5 months ago

Introduces a command to the gh_foundations cli tool to run checks against your github organization and repositories then output a report in a json format. The command requires either GITHUB_TOKEN environment variable to be set or gh cli to be installed and for the user to be logged in to authenticate against githubs REST api. For it's first iteration there is only one set of checks performed against the Gov of Canada's gaurdrails. More check types can be added later along with a command line option to configure what subset of checks get run or if all of them get run.

blastdan commented 5 months ago

Do you know if there is a way to use default credentials using the GH CLI that is easy? Just thinking about keeping the auth methods for everything the same.

TylerMizuyabu commented 5 months ago

Do you know if there is a way to use default credentials using the GH CLI that is easy? Just thinking about keeping the auth methods for everything the same.

After looking through the gh cli docs the best I think we could do would be to change the env var we use to be GH_TOKEN to match the variable used by github. I'm not seeing anything from them where they setup default credentials like gcloud does.

edit: We could do something similar to what their tf provider does and execute a gh auth token command from the cli and use the token output for auth. But we will need the token, otherwise some info about the org and repositories won't be returned. Also something to note would be that this method would require users to have the gh cli installed.