From 4f84be12e32969750ab341a0c0279778358fb465 Mon Sep 17 00:00:00 2001 From: Steffen Schmitz Date: Mon, 2 Mar 2020 17:11:46 +0100 Subject: [PATCH] fix #117 - handle whitespace in actrc secrets (#118) * fix #117 - handle whitespace in actrc secrets * Switch to raw string on regex pattern Co-authored-by: Casey Lee --- cmd/root.go | 3 ++- cmd/secrets.go | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd/root.go b/cmd/root.go index 6732993..38bf49f 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -6,6 +6,7 @@ import ( "fmt" "os" "path/filepath" + "regexp" "strings" "github.com/nektos/act/pkg/common" @@ -74,7 +75,7 @@ func readArgsFile(file string) []string { for scanner.Scan() { arg := scanner.Text() if strings.HasPrefix(arg, "-") { - args = append(args, strings.Fields(arg)...) + args = append(args, regexp.MustCompile(`\s`).Split(arg, 2)...) } } return args diff --git a/cmd/secrets.go b/cmd/secrets.go index e74f596..86ce175 100644 --- a/cmd/secrets.go +++ b/cmd/secrets.go @@ -14,7 +14,7 @@ type secrets map[string]string func newSecrets(secretList []string) secrets { s := make(map[string]string) for _, secretPair := range secretList { - secretPairParts := strings.Split(secretPair, "=") + secretPairParts := strings.SplitN(secretPair, "=", 2) if len(secretPairParts) == 2 { s[secretPairParts[0]] = secretPairParts[1] } else if env, ok := os.LookupEnv(secretPairParts[0]); ok && env != "" {