Skip to content

Commit 3fe058c

Browse files
committed
ci-helper: do require a config to be passed in
Now that even the original GitGitGadget installation has its config specified via a repository variable, we can avoid relying on the default config. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 5463dde commit 3fe058c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/ci-helper.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ import {
3333
} from "./pullRequestKey.js";
3434
import { ISMTPOptions } from "./send-mail.js";
3535
import { fileURLToPath } from "url";
36-
import defaultConfig from "./gitgitgadget-config.js";
3736

3837
const readFile = util.promisify(fs.readFile);
3938
type CommentFunction = (comment: string) => Promise<void>;
@@ -65,11 +64,12 @@ export class CIHelper {
6564

6665
public static validateConfig = typia.createValidate<IConfig>();
6766

68-
public static getConfigAsGitHubActionInput(): IConfig | undefined {
69-
if (process.env.GITHUB_ACTIONS !== "true") return undefined;
67+
public static getConfigAsGitHubActionInput(): IConfig {
68+
if (process.env.GITHUB_ACTIONS !== "true") throw new Error(`Need a config!`);
7069
const json = core.getInput("config");
71-
if (!json) return undefined;
70+
if (!json) throw new Error(`Need a config!`);
7271
const config = JSON.parse(json) as IConfig | undefined;
72+
if (!config) throw new Error(`Need a config!`);
7373
const result = CIHelper.validateConfig(config);
7474
if (result.success) return config;
7575
throw new Error(
@@ -80,7 +80,7 @@ export class CIHelper {
8080
}
8181

8282
public constructor(workDir: string = "pr-repo.git", config?: IConfig, skipUpdate?: boolean, gggConfigDir = ".") {
83-
this.config = config || CIHelper.getConfigAsGitHubActionInput() || defaultConfig;
83+
this.config = config || CIHelper.getConfigAsGitHubActionInput();
8484
this.gggConfigDir = gggConfigDir;
8585
this.workDir = workDir;
8686
this.notes = new GitNotes(workDir);

0 commit comments

Comments
 (0)