Skip to content

Commit c01e8d6

Browse files
committed
fix(baseBranch): Applies custom configured base branch back to Auto.baseBranch
1 parent 2566ec6 commit c01e8d6

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

packages/core/src/__tests__/auto.test.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,32 @@ describe("Auto", () => {
9898
expect(auto.release).toBeDefined();
9999
});
100100

101+
test("should set default baseBranch", async () => {
102+
search.mockReturnValueOnce({
103+
config: defaults,
104+
});
105+
106+
const auto = new Auto();
107+
auto.logger = dummyLog();
108+
await auto.loadConfig();
109+
expect(auto.baseBranch).toBe("master");
110+
});
111+
112+
test("should set custom baseBranch", async () => {
113+
search.mockReturnValueOnce({
114+
config: {
115+
...defaults,
116+
baseBranch: "production",
117+
},
118+
});
119+
120+
const auto = new Auto();
121+
auto.logger = dummyLog();
122+
await auto.loadConfig();
123+
expect(auto.baseBranch).toBe("production");
124+
expect(auto.config?.baseBranch).toBe("production");
125+
});
126+
101127
test("should default to npm in non-pkg", async () => {
102128
search.mockReturnValueOnce({ config: defaults });
103129
// @ts-ignore

packages/core/src/auto.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,9 +538,10 @@ export default class Auto {
538538
// This Line overrides config with args
539539
// eslint-disable-next-line @typescript-eslint/no-explicit-any
540540
...omit(this.options, ["_command", "_all", "main"] as any),
541-
baseBranch: this.baseBranch,
541+
baseBranch: this.config.baseBranch || this.baseBranch,
542542
};
543543
this.config = config;
544+
this.baseBranch = config.baseBranch;
544545
const repository = await this.getRepo(config);
545546
const token =
546547
repository?.token || process.env.GH_TOKEN || process.env.GITHUB_TOKEN;

0 commit comments

Comments
 (0)