summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilo Moisson <milomoisson@gmail.com>2024-01-21 21:16:06 +0100
committerGitHub <noreply@github.com>2024-01-21 21:16:06 +0100
commit6091094e14ab4e2940bc4bde12525d2dfd569e0b (patch)
treed13e36ea7eff99db9a0490a80f06a8607059fdfa
parentWorkflowDispatchConfig supports multiple yaml node kinds (#2123) (diff)
downloadforgejo-act-6091094e14ab4e2940bc4bde12525d2dfd569e0b.tar.xz
forgejo-act-6091094e14ab4e2940bc4bde12525d2dfd569e0b.zip
fix: write default config in XDG config dir to avoid cluttering the HOME directory by default (#2140)
Co-authored-by: Casey Lee <cplee@nektos.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
-rw-r--r--cmd/root.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/cmd/root.go b/cmd/root.go
index e595e52..319fdd5 100644
--- a/cmd/root.go
+++ b/cmd/root.go
@@ -107,6 +107,7 @@ func Execute(ctx context.Context, version string) {
}
}
+// Return locations where Act's config can be found in order : XDG spec, .actrc in HOME directory, .actrc in invocation directory
func configLocations() []string {
configFileName := ".actrc"
@@ -120,8 +121,8 @@ func configLocations() []string {
}
return []string{
- filepath.Join(UserHomeDir, configFileName),
actrcXdg,
+ filepath.Join(UserHomeDir, configFileName),
filepath.Join(".", configFileName),
}
}
@@ -557,6 +558,7 @@ func newRunCommand(ctx context.Context, input *Input) func(*cobra.Command, []str
}
}
if !cfgFound && len(cfgLocations) > 0 {
+ // The first config location refers to the XDG spec one
if err := defaultImageSurvey(cfgLocations[0]); err != nil {
log.Fatal(err)
}