vegardit/docker-gitea-act-runner

`GITEA_RUNNER_ACTION_CACHE_DIR` not work

MuXiu1997 opened this issue · 0 comments

Ref:
https://gitea.com/gitea/act_runner/src/commit/f17cad1bbe0d4a84308a37fb4a5e64211ada7e8a/internal/app/run/runner.go#L183
ActionCacheDir: filepath.FromSlash(r.cfg.Host.WorkdirParent),

runnerConfig := &runner.Config{
	// On Linux, Workdir will be like "/<parent_directory>/<owner>/<repo>"
	// On Windows, Workdir will be like "\<parent_directory>\<owner>\<repo>"
	Workdir:        filepath.FromSlash(fmt.Sprintf("/%s/%s", r.cfg.Container.WorkdirParent, preset.Repository)),
	BindWorkdir:    false,
	ActionCacheDir: filepath.FromSlash(r.cfg.Host.WorkdirParent),

	// ...
}

https://gitea.com/gitea/act/src/commit/15045b4fc0f33dfc6ab27b6398195d2c2e3f26ce/pkg/runner/run_context.go#L503-L505
if rc.Config.ActionCacheDir != "" { return rc.Config.ActionCacheDir }

// ActionCacheDir is for rc
func (rc *RunContext) ActionCacheDir() string {
	if rc.Config.ActionCacheDir != "" {
		return rc.Config.ActionCacheDir
	}
	var xdgCache string
	var ok bool
	if xdgCache, ok = os.LookupEnv("XDG_CACHE_HOME"); !ok || xdgCache == "" {
		if home, err := os.UserHomeDir(); err == nil {
			xdgCache = filepath.Join(home, ".cache")
		} else if xdgCache, err = filepath.Abs("."); err != nil {
			// It's almost impossible to get here, so the temp dir is a good fallback
			xdgCache = os.TempDir()
		}
	}
	return filepath.Join(xdgCache, "act")
}

Because ActionCacheDir is always set, XDG_CACHE_HOME is no longer respected