From 7cf56e04afc54d1f894a130270dfecf951ae23e0 Mon Sep 17 00:00:00 2001 From: Azeem Shaikh Date: Mon, 12 Jul 2021 13:59:44 -0700 Subject: [PATCH] Log error if GITHUB_AUTH_TOKEN is unset (#680) Co-authored-by: Azeem Shaikh --- cmd/root.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmd/root.go b/cmd/root.go index 4cb0c2e4..8fe8b1bb 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -67,6 +67,10 @@ or ./scorecard --{npm,pypi,rubgems}= [--checks=check1,...] [--show Short: "Security Scorecards", Long: "A program that shows security scorecard for an open source software.", Run: func(cmd *cobra.Command, args []string) { + if token, exists := os.LookupEnv("GITHUB_AUTH_TOKEN"); !exists || token == "" { + log.Fatalf("GITHUB_AUTH_TOKEN env var is not set. Please set this to your Github PAT before running this command.") + } + cfg := zap.NewProductionConfig() cfg.Level.SetLevel(*logLevel) logger, err := cfg.Build()