diff --git a/pkg/runner/step_context.go b/pkg/runner/step_context.go index 0db3ff7..84ce43b 100644 --- a/pkg/runner/step_context.go +++ b/pkg/runner/step_context.go @@ -130,14 +130,13 @@ func (sc *StepContext) Executor() common.Executor { func (sc *StepContext) mergeEnv() map[string]string { rc := sc.RunContext job := rc.Run.Job() - step := sc.Step var env map[string]string c := job.Container() if c != nil { - env = mergeMaps(rc.GetEnv(), c.Env, step.GetEnv()) + env = mergeMaps(rc.GetEnv(), c.Env) } else { - env = mergeMaps(rc.GetEnv(), step.GetEnv()) + env = rc.GetEnv() } if env["PATH"] == "" { @@ -176,6 +175,7 @@ func (sc *StepContext) setupEnv(ctx context.Context) (ExpressionEvaluator, error return nil, err } } + sc.Env = mergeMaps(sc.Env, sc.Step.GetEnv()) // step env should not be overwritten evaluator := sc.NewExpressionEvaluator() sc.interpolateEnv(evaluator) diff --git a/pkg/runner/testdata/local-action-dockerfile/push.yml b/pkg/runner/testdata/local-action-dockerfile/push.yml index 441b7f4..bc4b6fd 100644 --- a/pkg/runner/testdata/local-action-dockerfile/push.yml +++ b/pkg/runner/testdata/local-action-dockerfile/push.yml @@ -10,4 +10,7 @@ jobs: with: who-to-greet: 'Mona the Octocat' - run: '[[ "${{ env.SOMEVAR }}" == "Mona the Octocat" ]]' + - run: '[ "${SOMEVAR}" = "Not Mona" ] || exit 1' + env: + SOMEVAR: 'Not Mona' - uses: ./localdockerimagetest_