1
0
Fork 0
mirror of https://code.forgejo.org/forgejo/runner.git synced 2025-08-11 17:50:58 +00:00

Update Shell Tasks to match ScriptHandlerHelpers (#575)

* Update Shell Tasks to match ScriptHandlerHelpers
Code: https://github.com/actions/runner/blob/main/src/Runner.Worker/Handlers/ScriptHandlerHelpers.cs

Docs: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#using-a-specific-shell

Fixes #467

* 🩹 Remove old ps1 handler

* ♻️ gocritix fix

* 🐛 Powershell command must be a single entry to docker API
Fixes #467

* Remove Act Temp

* Remove additional Act Directories

* remove hard-coded workdir

Co-authored-by: Casey Lee <cplee@nektos.com>
This commit is contained in:
Justin Grote 2021-03-29 10:06:51 -07:00 committed by GitHub
parent e29e1ef2d6
commit 12268f9242
4 changed files with 48 additions and 4 deletions

View file

@ -257,11 +257,12 @@ func (s *Step) GetEnv() map[string]string {
func (s *Step) ShellCommand() string {
shellCommand := ""
//Reference: https://github.com/actions/runner/blob/8109c962f09d9acc473d92c595ff43afceddb347/src/Runner.Worker/Handlers/ScriptHandlerHelpers.cs#L9-L17
switch s.Shell {
case "", "bash":
shellCommand = "bash --login --norc -e {0}"
shellCommand = "bash --login --noprofile --norc -e -o pipefail {0}"
case "pwsh":
shellCommand = "pwsh -login -command \"& '{0}'\""
shellCommand = "pwsh -login -command . '{0}'"
case "python":
shellCommand = "python {0}"
case "sh":
@ -269,7 +270,7 @@ func (s *Step) ShellCommand() string {
case "cmd":
shellCommand = "%ComSpec% /D /E:ON /V:OFF /S /C \"CALL \"{0}\"\""
case "powershell":
shellCommand = "powershell -command \"& '{0}'\""
shellCommand = "powershell -command . '{0}'"
default:
shellCommand = s.Shell
}