diff --git a/dist/index.js b/dist/index.js index 77f45df..0f31ab3 100644 --- a/dist/index.js +++ b/dist/index.js @@ -47460,16 +47460,19 @@ var configSchema = object({ "perennial-regex": string3().optional() }).optional() }); +var CONFIG_FILE_NAMES = [".git-branches.toml", ".git-town.toml"]; var configFile; -try { - configFile = fs.readFileSync(".git-branches.toml").toString(); -} catch { - configFile = void 0; -} +CONFIG_FILE_NAMES.forEach((file) => { + try { + configFile ??= fs.readFileSync(file).toString(); + } catch { + configFile = void 0; + } +}); var parsed = configSchema.safeParse(toml.parse(configFile ?? "")); if (!parsed.success) { core3.warning( - "Failed to parse Git Town config. If this is a mistake, ensure that `.git-branches.toml` is valid." + "Failed to parse Git Town config. If this is a mistake, ensure that `.git-branches.toml`/`.git-town.toml` is valid." ); } var config = configFile && parsed.success ? parsed.data : void 0; diff --git a/src/config.ts b/src/config.ts index d96bf38..e36507a 100644 --- a/src/config.ts +++ b/src/config.ts @@ -15,19 +15,22 @@ const configSchema = object({ export type Config = z.infer -let configFile - -try { - configFile = fs.readFileSync('.git-branches.toml').toString() -} catch { - configFile = undefined -} +const CONFIG_FILE_NAMES = ['.git-branches.toml', '.git-town.toml'] +let configFile: string | undefined + +CONFIG_FILE_NAMES.forEach((file) => { + try { + configFile ??= fs.readFileSync(file).toString() + } catch { + configFile = undefined + } +}) const parsed = configSchema.safeParse(toml.parse(configFile ?? '')) if (!parsed.success) { core.warning( - 'Failed to parse Git Town config. If this is a mistake, ensure that `.git-branches.toml` is valid.' + 'Failed to parse Git Town config. If this is a mistake, ensure that `.git-branches.toml`/`.git-town.toml` is valid.' ) }