Repository: nektos/act (language: go)

Issue:
Windows build backslash issue
### Bug report info

```plain text
act version:            0.2.44
GOOS:                   windows
GOARCH:                 amd64
NumCPU:                 8
Docker host:            DOCKER_HOST environment variable is unset/empty.
Sockets found:
        \\.\pipe\docker_engine
Config files:
        C:\Users\headk\.actrc:
                -P ubuntu-latest=catthehacker/ubuntu:act-latest
                -P ubuntu-22.04=catthehacker/ubuntu:act-22.04
                -P ubuntu-20.04=catthehacker/ubuntu:act-20.04
                -P ubuntu-18.04=catthehacker/ubuntu:act-18.04
Build info:
        Go version:            go1.18.10
        Module path:           github.com/nektos/act
        Main version:          (devel)
        Main path:             github.com/nektos/act
        Main checksum:
        Build settings:
                -compiler:            gc
                -ldflags:             -s -w -X main.version=0.2.44 -X main.commit=220d6f1251aea75c378e5a98546f43cd918e1892 -X main.date=2023-04-01T02:18:17Z -X main.builtBy=goreleaser
                CGO_ENABLED:          0
                GOARCH:               amd64
                GOOS:                 windows
                GOAMD64:              v1
                vcs:                  git
                vcs.revision:         220d6f1251aea75c378e5a98546f43cd918e1892
                vcs.time:             2023-04-01T02:17:52Z
                vcs.modified:         false
Docker Engine:
        Engine version:        20.10.24
        Engine runtime:
        Cgroup version:
        Cgroup driver:
        Storage driver:        windowsfilter
        Registry URI:          https://index.docker.io/v1/
        OS:                    Windows 10 Pro Version 2009 (OS Build 19045.2846)
        OS type:               windows
        OS version:            10.0.19045
        OS arch:               x86_64
        OS kernel:             10.0 19045 (19041.1.amd64fre.vb_release.191206-1406)
        OS CPU:                8
        OS memory:             32748 MB
        Security options:
```


### Command used with act

```sh
act push -P windows-2019=-self-hosted
```


### Describe issue

Build fails because the folder used is `C:Usersheadk.cacheact8828939fe4ffb927act/workflow/2` when it should be `C:/Users/headk/.cache/act/8828939fe4ffb927/act/workflow/2`.

It looks like it's removing backslashes from the path.

### Link to GitHub repository

_No response_

### Workflow content

```yml
name: amd64_windows_gcc

on: [push, pull_request]

jobs:

  amd64_windows_gcc:
    runs-on: windows-2019
    timeout-minutes: 5
    defaults:
      run:
        shell: msys2 {0}
    steps:
    - uses: actions/checkout@v3
    - uses: msys2/setup-msys2@v2
      with:
        install: gcc make
    - run: make
```


### Relevant log output

```sh
| Database directory: /var/lib/pacman/
| :: Do you want to remove unused repositories? [Y/n]
| removing unused sync repositories...
[amd64_windows_gcc/amd64_windows_gcc]   ❓  ::endgroup::
[amd64_windows_gcc/amd64_windows_gcc]   ✅  Success - Main msys2/setup-msys2@v2
[amd64_windows_gcc/amd64_windows_gcc]   ⚙  ::set-env:: MSYSTEM=MINGW64
[amd64_windows_gcc/amd64_windows_gcc]   ⚙  ::add-path:: C:\Users\headk\.cache\act\8828939fe4ffb927\tmp\setup-msys2
[amd64_windows_gcc/amd64_windows_gcc] ⭐ Run Main gcc -v
| /usr/bin/bash: C:Usersheadk.cacheact8828939fe4ffb927act/workflow/2: No such file or directory
[amd64_windows_gcc/amd64_windows_gcc]   ❌  Failure - Main gcc -v
[amd64_windows_gcc/amd64_windows_gcc] exit status 1
[amd64_windows_gcc/amd64_windows_gcc] 🏁  Job failed
Error: Job 'amd64_windows_gcc' failed
```


### Additional information

_No response_


Discussion / hints:
I made the following change in `host_environment.go` and it successfully builds.

```go
func (e *HostEnvironment) GetActPath() string {
	actPath := e.ActPath
	if runtime.GOOS == "windows" {
		actPath = strings.ReplaceAll(actPath, "\\", "/")
	}
	return actPath
}
```
Output:
```
[amd64_windows_gcc/amd64_windows_gcc]   ❓  ::endgroup::
[amd64_windows_gcc/amd64_windows_gcc]   ✅  Success - Main msys2/setup-msys2@v2
[amd64_windows_gcc/amd64_windows_gcc]   ⚙  ::set-env:: MSYSTEM=MINGW64
[amd64_windows_gcc/amd64_windows_gcc]   ⚙  ::add-path:: C:\Users\headk\.cache\act\a572ac3a060595c5\tmp\setup-msys2
[amd64_windows_gcc/amd64_windows_gcc] ⭐ Run Main make
| mkdir -p bin
| gcc -O2 -Wall -o bin/gfx2next src/lodepng.c src/zx0.c src/gfx2next.c -lm
[amd64_windows_gcc/amd64_windows_gcc]   ✅  Success - Main make
[amd64_windows_gcc/amd64_windows_gcc] 🏁  Job succeeded
```
Do you want a pull request?
I don't think that running `msys2 C:\Users\headk\.cache\act\8828939fe4ffb927\act\workflow\2` is a bug from act.

`\` is a valid PATH seperator on windows. Use a different shell syntax, e.g. convert `\` to `/` within the shell and run the script after that. (`msys2 -c "msys2 $(echo '{0}' | sed 's|\\|/|g')"`, I don't claim that this works)

> `\` is a valid PATH seperator on windows. Use a different shell syntax, e.g. convert `\` to `/` within the shell and run the script after that. (`msys2 -c "msys2 $(echo '{0}' | sed 's|\\|/|g')"`, I don't claim that this works)

I see backslash replacements in other parts of this tool such as [here](https://github.com/nektos/act/blob/master/pkg/runner/action.go#L420) and [here](https://github.com/nektos/act/blob/master/pkg/runner/action.go#L429) so I don't see why it's not a valid solution to do the same for `GetActPath`?
> I see backslash replacements in other parts of this tool such

The code you are quoting is for linux container, `\` is an escape char on linux.

Seems like the cmd doesn't break while seeing `cmd /D /E:ON /V:OFF /S /C "CALL tes443/test.bat"`, so my concerns are resolved. Create a PR if you want, I'm not the only one who can merge this for you.

Fix patch:
diff --git a/pkg/container/host_environment.go b/pkg/container/host_environment.go
index abc1115a1e7..e0a18c7c526 100644
--- a/pkg/container/host_environment.go
+++ b/pkg/container/host_environment.go
@@ -362,7 +362,11 @@ func (e *HostEnvironment) ToContainerPath(path string) string {
 }
 
 func (e *HostEnvironment) GetActPath() string {
-	return e.ActPath
+	actPath := e.ActPath
+	if runtime.GOOS == "windows" {
+		actPath = strings.ReplaceAll(actPath, "\\", "/")
+	}
+	return actPath
 }
 
 func (*HostEnvironment) GetPathVariableName() string {


Test patch: