mirror of
https://code.forgejo.org/forgejo/runner.git
synced 2025-09-15 18:57:01 +00:00
Merge pull request 'feat: add node as shell type' (#120) from Maks1mS/act:feat/node-as-shell-type into main
Reviewed-on: https://code.forgejo.org/forgejo/act/pulls/120 Reviewed-by: Michael Kriese <michael.kriese@gmx.de> Reviewed-by: limiting-factor <limiting-factor@noreply.code.forgejo.org>
This commit is contained in:
commit
91528a6af7
4 changed files with 31 additions and 0 deletions
|
@ -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
|
||||
}
|
||||
|
|
|
@ -510,6 +510,8 @@ func TestStep_ShellCommand(t *testing.T) {
|
|||
{"pwsh -v '. {0}'", "pwsh -v '. {0}'"},
|
||||
{"pwsh", "pwsh -command . '{0}'"},
|
||||
{"powershell", "powershell -command . '{0}'"},
|
||||
{"node", "node {0}"},
|
||||
{"python", "python {0}"},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.shell, func(t *testing.T) {
|
||||
|
|
|
@ -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)
|
||||
|
|
25
act/runner/testdata/shells/node/push.yml
vendored
Normal file
25
act/runner/testdata/shells/node/push.yml
vendored
Normal file
|
@ -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)
|
Loading…
Add table
Add a link
Reference in a new issue