From 8339f4b4040fb68b457af7655336573df7c28c04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cat=E2=84=A2?= Date: Sun, 31 Jan 2021 02:43:11 +0100 Subject: [PATCH] Interpolate `with:` inputs (#511) --- pkg/runner/expression.go | 3 ++- pkg/runner/step_context.go | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/runner/expression.go b/pkg/runner/expression.go index 757587d6..3daf09f2 100644 --- a/pkg/runner/expression.go +++ b/pkg/runner/expression.go @@ -343,8 +343,9 @@ func (sc *StepContext) vmInputs() func(*otto.Otto) { } for k, v := range sc.Step.With { - inputs[k] = v + inputs[k] = sc.RunContext.NewExpressionEvaluator().Interpolate(v) } + return func(vm *otto.Otto) { _ = vm.Set("inputs", inputs) } diff --git a/pkg/runner/step_context.go b/pkg/runner/step_context.go index 8972ede7..95bc10b8 100644 --- a/pkg/runner/step_context.go +++ b/pkg/runner/step_context.go @@ -241,7 +241,7 @@ func (sc *StepContext) runUsesContainer() common.Executor { step := sc.Step return func(ctx context.Context) error { image := strings.TrimPrefix(step.Uses, "docker://") - cmd := strings.Fields(step.With["args"]) + cmd := strings.Fields(sc.RunContext.NewExpressionEvaluator().Interpolate(step.With["args"])) entrypoint := strings.Fields(step.With["entrypoint"]) stepContainer := sc.newStepContainer(ctx, image, cmd, entrypoint)