From 14dac1d57a3339ea27520ede2c223653f05ab177 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Doma=C5=84ski?= Date: Tue, 23 Feb 2021 18:47:06 +0100 Subject: [PATCH] properly parse arguments to Docker container steps (#539) --- act/runner/step_context.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/act/runner/step_context.go b/act/runner/step_context.go index 95bc10b8..908c783c 100644 --- a/act/runner/step_context.go +++ b/act/runner/step_context.go @@ -11,6 +11,7 @@ import ( "strings" log "github.com/sirupsen/logrus" + "github.com/kballard/go-shellquote" "github.com/nektos/act/pkg/common" "github.com/nektos/act/pkg/container" @@ -241,7 +242,10 @@ func (sc *StepContext) runUsesContainer() common.Executor { step := sc.Step return func(ctx context.Context) error { image := strings.TrimPrefix(step.Uses, "docker://") - cmd := strings.Fields(sc.RunContext.NewExpressionEvaluator().Interpolate(step.With["args"])) + cmd, err := shellquote.Split(sc.RunContext.NewExpressionEvaluator().Interpolate(step.With["args"])) + if err != nil { + return err + } entrypoint := strings.Fields(step.With["entrypoint"]) stepContainer := sc.newStepContainer(ctx, image, cmd, entrypoint) @@ -355,7 +359,10 @@ func (sc *StepContext) runAction(actionDir string, actionPath string) common.Exe }) } - cmd := strings.Fields(step.With["args"]) + cmd, err := shellquote.Split(step.With["args"]) + if err != nil { + return err + } if len(cmd) == 0 { cmd = action.Runs.Args }