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

View File

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