From 6fd5a6c9abd27625ac7f1bf1bdcef591e7f929a0 Mon Sep 17 00:00:00 2001 From: ChristopherHX Date: Mon, 26 Sep 2022 08:08:08 +0200 Subject: [PATCH] fix: missing defaults in nodejs pre (#1349) * Update action.go * add Test Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> --- act/runner/action.go | 2 ++ act/runner/runner_test.go | 1 + .../push.yml | 23 +++++++++++++++++++ 3 files changed, 26 insertions(+) create mode 100644 act/runner/testdata/remote-action-composite-js-pre-with-defaults/push.yml diff --git a/act/runner/action.go b/act/runner/action.go index 85e18e00..97674c86 100644 --- a/act/runner/action.go +++ b/act/runner/action.go @@ -481,6 +481,8 @@ func runPreStep(step actionStep) common.Executor { switch action.Runs.Using { case model.ActionRunsUsingNode12, model.ActionRunsUsingNode16: + // defaults in pre steps were missing, however provided inputs are available + populateEnvsFromInput(ctx, step.getEnv(), action, rc) // todo: refactor into step var actionDir string var actionPath string diff --git a/act/runner/runner_test.go b/act/runner/runner_test.go index b57b4ab9..c307d52a 100644 --- a/act/runner/runner_test.go +++ b/act/runner/runner_test.go @@ -137,6 +137,7 @@ func TestRunEvent(t *testing.T) { {workdir, "uses-composite", "push", "", platforms}, {workdir, "uses-composite-with-error", "push", "Job 'failing-composite-action' failed", platforms}, {workdir, "uses-nested-composite", "push", "", platforms}, + {workdir, "remote-action-composite-js-pre-with-defaults", "push", "", platforms}, {workdir, "uses-workflow", "push", "reusable workflows are currently not supported (see https://github.com/nektos/act/issues/826 for updates)", platforms}, {workdir, "uses-docker-url", "push", "", platforms}, {workdir, "act-composite-env-test", "push", "", platforms}, diff --git a/act/runner/testdata/remote-action-composite-js-pre-with-defaults/push.yml b/act/runner/testdata/remote-action-composite-js-pre-with-defaults/push.yml new file mode 100644 index 00000000..90a2987d --- /dev/null +++ b/act/runner/testdata/remote-action-composite-js-pre-with-defaults/push.yml @@ -0,0 +1,23 @@ +name: remote-action-composite-js-pre-with-defaults +on: push + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: nektos/act-test-actions/composite-js-pre-with-defaults/js@main + with: + in: nix + - uses: nektos/act-test-actions/composite-js-pre-with-defaults@main + with: + in: secretval + - uses: nektos/act-test-actions/composite-js-pre-with-defaults@main + with: + in: secretval + - uses: nektos/act-test-actions/composite-js-pre-with-defaults/js@main + with: + pre: "true" + in: nix + - uses: nektos/act-test-actions/composite-js-pre-with-defaults/js@main + with: + in: nix \ No newline at end of file