feat: custom host env dir for api (#92)

This commit is contained in:
ChristopherHX
2025-04-26 12:55:45 +02:00
committed by GitHub
parent 0aca9b8144
commit dfbb094199
2 changed files with 13 additions and 3 deletions

View File

@@ -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