@@ -330,6 +330,10 @@ func readYamlFile(file string) (map[string]string, error) {
330330}
331331
332332func readEnvs (path string , envs map [string ]string ) bool {
333+ return readEnvsEx (path , envs , false )
334+ }
335+
336+ func readEnvsEx (path string , envs map [string ]string , caseInsensitive bool ) bool {
333337 if _ , err := os .Stat (path ); err == nil {
334338 var env map [string ]string
335339 if ext := filepath .Ext (path ); ext == ".yml" || ext == ".yaml" {
@@ -341,6 +345,9 @@ func readEnvs(path string, envs map[string]string) bool {
341345 log .Fatalf ("Error loading from %s: %v" , path , err )
342346 }
343347 for k , v := range env {
348+ if caseInsensitive {
349+ k = strings .ToUpper (k )
350+ }
344351 if _ , ok := envs [k ]; ! ok {
345352 envs [k ] = v
346353 }
@@ -411,14 +418,9 @@ func newRunCommand(ctx context.Context, input *Input) func(*cobra.Command, []str
411418
412419 log .Debugf ("Loading secrets from %s" , input .Secretfile ())
413420 secrets := newSecrets (input .secrets )
414- _ = readEnvs (input .Secretfile (), secrets )
415- hasGitHubToken := false
416- for k := range secrets {
417- if strings .EqualFold (k , "GITHUB_TOKEN" ) {
418- hasGitHubToken = true
419- }
420- }
421- if ! hasGitHubToken {
421+ _ = readEnvsEx (input .Secretfile (), secrets , true )
422+
423+ if _ , hasGitHubToken := secrets ["GITHUB_TOKEN" ]; ! hasGitHubToken {
422424 secrets ["GITHUB_TOKEN" ], _ = gh .GetToken (ctx , "" )
423425 }
424426
0 commit comments