diff --git a/cmd/action/main.go b/cmd/action/main.go index 5316248d..47c0fd49 100644 --- a/cmd/action/main.go +++ b/cmd/action/main.go @@ -6,6 +6,7 @@ import ( "fmt" "os" + "github.com/buildkite/shellwords" "github.com/futurice/jalapeno/internal/cli" "github.com/gofrs/uuid" ) @@ -24,11 +25,17 @@ func main() { output, err := os.OpenFile(os.Getenv("GITHUB_OUTPUT"), os.O_APPEND|os.O_WRONLY, 0644) checkErr(err) + // Since arguments are passed as a single string, we need to split them + args, err := shellwords.Split(os.Args[1]) + checkErr(err) + delimiter := uuid.Must(uuid.NewV4()).String() - fmt.Fprintf(output, "%s << %s\n", OutputResult, delimiter) + fmt.Fprintf(output, "%s<<%s\n", OutputResult, delimiter) cmd := cli.NewRootCmd("") cmd.SetOut(output) + cmd.SetArgs(args) + err = cmd.ExecuteContext(context.Background()) fmt.Fprintf(output, "%s\n", delimiter) diff --git a/go.mod b/go.mod index d02cc849..8d0294d2 100644 --- a/go.mod +++ b/go.mod @@ -25,6 +25,7 @@ require ( github.com/atotto/clipboard v0.1.4 // indirect github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect github.com/aymanbagabas/go-udiff v0.1.0 // indirect + github.com/buildkite/shellwords v0.0.0-20180315110454-59467a9b8e10 // indirect github.com/cenkalti/backoff/v4 v4.2.1 // indirect github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81 // indirect github.com/cucumber/gherkin/go/v26 v26.2.0 // indirect diff --git a/go.sum b/go.sum index b0631d59..66b7c57e 100644 --- a/go.sum +++ b/go.sum @@ -18,6 +18,8 @@ github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiE github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8= github.com/aymanbagabas/go-udiff v0.1.0 h1:9Dpklm2oBBhMxIFbMffmPvDaF7vOYfv9B5HXVr42KMU= github.com/aymanbagabas/go-udiff v0.1.0/go.mod h1:RE4Ex0qsGkTAJoQdQQCA0uG+nAzJO/pI/QwceO5fgrA= +github.com/buildkite/shellwords v0.0.0-20180315110454-59467a9b8e10 h1:XwHQ5xDtYPdtBbVPyRO6UZoWZe8/mbKUb076f8x7RvI= +github.com/buildkite/shellwords v0.0.0-20180315110454-59467a9b8e10/go.mod h1:gv0DYOzHEsKgo31lTCDGauIg4DTTGn41Bzp+t3wSOlk= github.com/carlmjohnson/versioninfo v0.22.5 h1:O00sjOLUAFxYQjlN/bzYTuZiS0y6fWDQjMRvwtKgwwc= github.com/carlmjohnson/versioninfo v0.22.5/go.mod h1:QT9mph3wcVfISUKd0i9sZfVrPviHuSF+cUtLjm2WSf8= github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM=