Merge pull request #18 from github/gracefully-fail-if-token-envvar-unset

cmd/ghcs/main: Fail gracefully if `GITHUB_TOKEN` entirely unset
This commit is contained in:
Issy Long 2021-07-20 13:02:35 +01:00 committed by GitHub
commit f7e32485fc

View file

@ -22,6 +22,11 @@ var rootCmd = &cobra.Command{
}
func Execute() {
if os.Getenv("GITHUB_TOKEN") == "" {
fmt.Println("The GITHUB_TOKEN environment variable is required. Create a Personal Access Token with org SSO access at https://github.com/settings/tokens/new.")
os.Exit(1)
}
if err := rootCmd.Execute(); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)