Skip to content
This repository was archived by the owner on Dec 9, 2023. It is now read-only.

Commit 16bf3a1

Browse files
committed
fix(projects): add main branch config
1 parent c37a517 commit 16bf3a1

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/cli.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import cac from 'cac';
66
import { version } from '../package.json';
77
import { generate } from './generate';
88
import { hasTagOnGitHub, sendRelease } from './github';
9-
import { isRepoShallow, getGitPushUrl, getGitMainBranchName } from './git';
9+
import { isRepoShallow, getGitPushUrl } from './git';
1010
import type { ChangelogOptions } from './types';
1111

1212
const cli = cac('githublogen');
@@ -83,8 +83,6 @@ cli.command('').action(async (args: any) => {
8383

8484
const { email = '[email protected]', name = 'unknow' } = commits[0]?.author || {};
8585

86-
const branchMain = await getGitMainBranchName();
87-
8886
await execa('git', ['config', '--global', 'user.email', `"${email}"`]);
8987

9088
await execa('git', ['config', '--global', 'user.name', `"${name}"`]);
@@ -93,7 +91,7 @@ cli.command('').action(async (args: any) => {
9391

9492
await execa('git', ['commit', '-m', '"docs(projects): CHANGELOG.md"'], { cwd });
9593

96-
await execa('git', ['push', pushUrl, `HEAD:${branchMain}`], { cwd });
94+
await execa('git', ['push', pushUrl, `HEAD:${config.gitMainBranch}`], { cwd });
9795
}
9896

9997
if (!(await hasTagOnGitHub(config.to, config))) {

src/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const defaultConfig: ChangelogOptions = {
66
cwd: process.cwd(),
77
from: '',
88
to: '',
9+
gitMainBranch: 'main',
910
scopeMap: {},
1011
repo: {},
1112
types: {

src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export interface ChangelogConfig {
1919
to: string;
2020
newVersion?: string;
2121
output: string | boolean;
22+
gitMainBranch: string;
2223
}
2324

2425
export interface GitCommitAuthor {

0 commit comments

Comments
 (0)