Merge pull request #6195 from shoukoo/shoukoo.add-default-branch
feat: add default branch prop for publish:github action
This commit is contained in:
@@ -184,8 +184,9 @@ export class Git {
|
||||
logger?: Logger | undefined;
|
||||
}) => Git;
|
||||
// (undocumented)
|
||||
init({ dir }: {
|
||||
init({ dir, defaultBranch, }: {
|
||||
dir: string;
|
||||
defaultBranch?: string;
|
||||
}): Promise<void>;
|
||||
// (undocumented)
|
||||
merge({ dir, theirs, ours, author, committer, }: {
|
||||
|
||||
@@ -201,14 +201,16 @@ describe('Git', () => {
|
||||
describe('init', () => {
|
||||
it('should call isomorphic-git with the correct arguments', async () => {
|
||||
const dir = '/some/mock/dir';
|
||||
const defaultBranch = 'master';
|
||||
|
||||
const git = Git.fromAuth({});
|
||||
|
||||
await git.init({ dir });
|
||||
await git.init({ dir, defaultBranch });
|
||||
|
||||
expect(isomorphic.init).toHaveBeenCalledWith({
|
||||
fs,
|
||||
dir,
|
||||
defaultBranch,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -150,12 +150,19 @@ export class Git {
|
||||
});
|
||||
}
|
||||
|
||||
async init({ dir }: { dir: string }): Promise<void> {
|
||||
async init({
|
||||
dir,
|
||||
defaultBranch = 'master',
|
||||
}: {
|
||||
dir: string;
|
||||
defaultBranch?: string;
|
||||
}): Promise<void> {
|
||||
this.config.logger?.info(`Init git repository {dir=${dir}}`);
|
||||
|
||||
return git.init({
|
||||
fs,
|
||||
dir,
|
||||
defaultBranch,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user