Allow to override location of action cache dir (#1863)

Adds an option to specify the directory below which actions
and host workspaces will be stored. If left empty the previous
location at $XDG_CACHE_HOME/act or $HOME/.cache/act will be used
respectively.

Co-authored-by: Casey Lee <cplee@nektos.com>
This commit is contained in:
Marius Zwicker
2023-06-15 03:16:00 +02:00
committed by GitHub
parent 24348ff1ee
commit 74c27db4dd
4 changed files with 7 additions and 0 deletions

View File

@@ -383,6 +383,9 @@ func (rc *RunContext) stopJobContainer() common.Executor {
// 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 == "" {

View File

@@ -22,6 +22,7 @@ type Runner interface {
type Config struct {
Actor string // the user that triggered the event
Workdir string // path to working directory
ActionCacheDir string // path used for caching action contents
BindWorkdir bool // bind the workdir to the job container
EventName string // name of event to run
EventPath string // path to JSON file to use for event.json in containers