diff --git a/pkg/runner/run_context.go b/pkg/runner/run_context.go index 5b0864a0..89d2551c 100644 --- a/pkg/runner/run_context.go +++ b/pkg/runner/run_context.go @@ -188,9 +188,18 @@ func (rc *RunContext) startHostEnvironment() common.Executor { return true }) cacheDir := rc.ActionCacheDir() - randBytes := make([]byte, 8) - _, _ = rand.Read(randBytes) - miscpath := filepath.Join(cacheDir, hex.EncodeToString(randBytes)) + var miscpath string + workdir := rc.Config.HostEnvironmentDir + if workdir == "" { + randBytes := make([]byte, 8) + _, _ = rand.Read(randBytes) + workdir = hex.EncodeToString(randBytes) + } + if filepath.IsAbs(workdir) { + miscpath = workdir + } else { + miscpath = filepath.Join(cacheDir, workdir) + } actPath := filepath.Join(miscpath, "act") if err := os.MkdirAll(actPath, 0o777); err != nil { return err diff --git a/pkg/runner/runner.go b/pkg/runner/runner.go index 37da7dd3..a432f63f 100644 --- a/pkg/runner/runner.go +++ b/pkg/runner/runner.go @@ -61,6 +61,7 @@ type Config struct { Matrix map[string]map[string]bool // Matrix config to run ContainerNetworkMode docker_container.NetworkMode // the network mode of job containers (the value of --network) ActionCache ActionCache // Use a custom ActionCache Implementation + HostEnvironmentDir string // Custom folder for host environment, parallel jobs must be 1 } type caller struct {