From 6037182487e39d9f50c6887ab3453986fbf29a9b 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> --- pkg/runner/action.go | 2 ++ pkg/runner/runner_test.go | 1 + .../push.yml | 23 +++++++++++++++++++ 3 files changed, 26 insertions(+) create mode 100644 pkg/runner/testdata/remote-action-composite-js-pre-with-defaults/push.yml diff --git a/pkg/runner/action.go b/pkg/runner/action.go index 85e18e0..97674c8 100644 --- a/pkg/runner/action.go +++ b/pkg/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/pkg/runner/runner_test.go b/pkg/runner/runner_test.go index b57b4ab..c307d52 100644 --- a/pkg/runner/runner_test.go +++ b/pkg/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/pkg/runner/testdata/remote-action-composite-js-pre-with-defaults/push.yml b/pkg/runner/testdata/remote-action-composite-js-pre-with-defaults/push.yml new file mode 100644 index 0000000..90a2987 --- /dev/null +++ b/pkg/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