diff --git a/pkg/runner/step_context.go b/pkg/runner/step_context.go index d31f2d7e..939ebdd1 100644 --- a/pkg/runner/step_context.go +++ b/pkg/runner/step_context.go @@ -479,6 +479,11 @@ func (sc *StepContext) runAction(actionDir string, actionPath string, localActio sc.Env = mergeMaps(sc.Env, action.Runs.Env) + ee := sc.NewExpressionEvaluator() + for k, v := range sc.Env { + sc.Env[k] = ee.Interpolate(v) + } + log.Debugf("type=%v actionDir=%s actionPath=%s workdir=%s actionCacheDir=%s actionName=%s containerActionDir=%s", step.Type(), actionDir, actionPath, rc.Config.Workdir, rc.ActionCacheDir(), actionName, containerActionDir) maybeCopyToActionDir := func() error { diff --git a/pkg/runner/testdata/actions/docker-local/action.yml b/pkg/runner/testdata/actions/docker-local/action.yml index 9b136f8f..5d3ce624 100644 --- a/pkg/runner/testdata/actions/docker-local/action.yml +++ b/pkg/runner/testdata/actions/docker-local/action.yml @@ -11,5 +11,7 @@ outputs: runs: using: 'docker' image: 'Dockerfile' + env: + WHOAMI: ${{ inputs.who-to-greet }} args: - ${{ inputs.who-to-greet }} diff --git a/pkg/runner/testdata/actions/docker-local/entrypoint.sh b/pkg/runner/testdata/actions/docker-local/entrypoint.sh index bff7aa7b..43ca2dd8 100755 --- a/pkg/runner/testdata/actions/docker-local/entrypoint.sh +++ b/pkg/runner/testdata/actions/docker-local/entrypoint.sh @@ -3,5 +3,6 @@ echo "Hello $1" time=$(date) echo ::set-output name=time::$time +echo ::set-output name=whoami::$WHOAMI echo "SOMEVAR=$1" >>$GITHUB_ENV diff --git a/pkg/runner/testdata/local-action-dockerfile/push.yml b/pkg/runner/testdata/local-action-dockerfile/push.yml index bc4b6fda..4940b98c 100644 --- a/pkg/runner/testdata/local-action-dockerfile/push.yml +++ b/pkg/runner/testdata/local-action-dockerfile/push.yml @@ -7,10 +7,12 @@ jobs: steps: - uses: actions/checkout@v2 - uses: ./actions/docker-local + id: dockerlocal with: who-to-greet: 'Mona the Octocat' - run: '[[ "${{ env.SOMEVAR }}" == "Mona the Octocat" ]]' - run: '[ "${SOMEVAR}" = "Not Mona" ] || exit 1' env: SOMEVAR: 'Not Mona' + - run: '[[ "${{ steps.dockerlocal.outputs.whoami }}" == "Mona the Octocat" ]]' - uses: ./localdockerimagetest_