diff --git a/pkg/runner/runner.go b/pkg/runner/runner.go index 64ba8e8..aa66af7 100644 --- a/pkg/runner/runner.go +++ b/pkg/runner/runner.go @@ -14,7 +14,6 @@ import ( "github.com/nektos/act/pkg/common" "github.com/nektos/act/pkg/container" - "github.com/nektos/act/pkg/exprparser" "github.com/nektos/act/pkg/model" ) @@ -165,10 +164,7 @@ func (runner *runnerImpl) NewPlanExecutor(plan *model.Plan) common.Executor { // evaluate environment variables since they can contain // GitHub's special environment variables. for k, v := range rc.GetEnv() { - valueEval, err := rc.ExprEval.evaluate(ctx, v, exprparser.DefaultStatusCheckNone) - if err == nil { - rc.Env[k] = fmt.Sprintf("%v", valueEval) - } + rc.Env[k] = rc.ExprEval.Interpolate(ctx, v) } if len(rc.String()) > maxJobNameLen { maxJobNameLen = len(rc.String()) diff --git a/pkg/runner/runner_test.go b/pkg/runner/runner_test.go index 8f166a3..fd0d67d 100644 --- a/pkg/runner/runner_test.go +++ b/pkg/runner/runner_test.go @@ -177,6 +177,7 @@ func TestRunEvent(t *testing.T) { {workdir, "if-expressions", "push", "Job 'mytest' failed", platforms}, {workdir, "actions-environment-and-context-tests", "push", "", platforms}, {workdir, "uses-action-with-pre-and-post-step", "push", "", platforms}, + {workdir, "evalenv", "push", "", platforms}, {"../model/testdata", "strategy", "push", "", platforms}, // TODO: move all testdata into pkg so we can validate it with planner and runner // {"testdata", "issue-228", "push", "", platforms, }, // TODO [igni]: Remove this once everything passes {"../model/testdata", "container-volumes", "push", "", platforms}, diff --git a/pkg/runner/testdata/evalenv/push.yml b/pkg/runner/testdata/evalenv/push.yml new file mode 100644 index 0000000..3d2c97c --- /dev/null +++ b/pkg/runner/testdata/evalenv/push.yml @@ -0,0 +1,21 @@ +name: CI + +on: push +jobs: + test: + runs-on: ubuntu-latest + env: + BUILD_DIR: ${{ github.workspace }}/build + steps: + - name: Dump + run: | + echo "$BUILD_DIR" + echo "$EXPECTED_BUILD_DIR" + echo "$GITHUB_WORKSPACE/build" + env: + EXPECTED_BUILD_DIR: ${{ github.workspace }}/build + - name: Test + run: | + [ "$BUILD_DIR" = "$EXPECTED_BUILD_DIR" ] && [ "$BUILD_DIR" = "$GITHUB_WORKSPACE/build" ] + env: + EXPECTED_BUILD_DIR: ${{ github.workspace }}/build