From e97623bbaf5a0ddef1f32b4fb0b299f212a4be6c Mon Sep 17 00:00:00 2001 From: Maxim Slipenko Date: Fri, 18 Apr 2025 18:14:21 +0300 Subject: [PATCH] feat: add node as shell type --- act/model/workflow.go | 2 ++ act/runner/step_run.go | 2 ++ act/runner/testdata/shells/node/push.yml | 25 ++++++++++++++++++++++++ 3 files changed, 29 insertions(+) create mode 100644 act/runner/testdata/shells/node/push.yml diff --git a/act/model/workflow.go b/act/model/workflow.go index eda6e089..7b28ceb0 100644 --- a/act/model/workflow.go +++ b/act/model/workflow.go @@ -639,6 +639,8 @@ func (s *Step) ShellCommand() string { shellCommand = "cmd /D /E:ON /V:OFF /S /C \"CALL \"{0}\"\"" case "powershell": shellCommand = "powershell -command . '{0}'" + case "node": + shellCommand = "node {0}" default: shellCommand = s.Shell } diff --git a/act/runner/step_run.go b/act/runner/step_run.go index 054ed702..376cc090 100644 --- a/act/runner/step_run.go +++ b/act/runner/step_run.go @@ -127,6 +127,8 @@ func (sr *stepRun) setupShellCommand(ctx context.Context) (name, script string, runPrepend = "@echo off" case "python": name += ".py" + case "node": + name += ".js" } script = fmt.Sprintf("%s\n%s\n%s", runPrepend, script, runAppend) diff --git a/act/runner/testdata/shells/node/push.yml b/act/runner/testdata/shells/node/push.yml new file mode 100644 index 00000000..dae1fe9f --- /dev/null +++ b/act/runner/testdata/shells/node/push.yml @@ -0,0 +1,25 @@ +on: push +env: + MY_SHELL: node +jobs: + check: + runs-on: ubuntu-latest + steps: + - shell: ${{ env.MY_SHELL }} + run: | + console.log(process.version) + check-container: + runs-on: ubuntu-latest + container: node:16-buster-slim + steps: + - shell: ${{ env.MY_SHELL }} + run: | + console.log(process.version) + check-job-default: + runs-on: ubuntu-latest + defaults: + run: + shell: ${{ env.MY_SHELL }} + steps: + - run: | + console.log(process.version)