fix(forge): create config directory before saving
Some checks are pending
Test / test (push) Waiting to run
Security Scan / security (push) Successful in 15s

Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
Virgil 2026-04-02 08:44:36 +00:00
parent 4b27f1072a
commit 6236446883

View file

@ -56,6 +56,7 @@ func readConfigFile() (url, token string, err error) {
}
// SaveConfig persists the Forgejo URL and API token to the default config file.
// It creates the parent directory if it does not already exist.
//
// Usage:
//
@ -65,6 +66,9 @@ func SaveConfig(url, token string) error {
if err != nil {
return err
}
if err := coreio.Local.EnsureDir(filepath.Dir(path)); err != nil {
return core.E("SaveConfig", "forge: create config directory", err)
}
payload, err := json.MarshalIndent(configFile{URL: url, Token: token}, "", " ")
if err != nil {
return core.E("SaveConfig", "forge: encode config file", err)