Merge pull request #15742 from ValtechMobility/feat/9736/add_commit_message_for_bitbucket

default commit msgs for bitbucketServer
This commit is contained in:
Johan Haals
2023-01-16 13:29:48 +01:00
committed by GitHub
4 changed files with 56 additions and 10 deletions
+3
View File
@@ -341,6 +341,9 @@ export function createPublishBitbucketServerAction(options: {
sourcePath?: string | undefined;
enableLFS?: boolean | undefined;
token?: string | undefined;
gitCommitMessage?: string | undefined;
gitAuthorName?: string | undefined;
gitAuthorEmail?: string | undefined;
}>;
// @public
@@ -375,7 +375,11 @@ describe('publish:bitbucketServer', () => {
defaultBranch: 'master',
auth: { token: 'thing' },
logger: mockContext.logger,
gitAuthorInfo: {},
commitMessage: 'initial commit',
gitAuthorInfo: {
email: undefined,
name: undefined,
},
});
});
@@ -429,7 +433,11 @@ describe('publish:bitbucketServer', () => {
defaultBranch: 'master',
auth: { username: 'test-user', password: 'test-password' },
logger: mockContext.logger,
gitAuthorInfo: {},
commitMessage: 'initial commit',
gitAuthorInfo: {
email: undefined,
name: undefined,
},
});
});
@@ -481,7 +489,11 @@ describe('publish:bitbucketServer', () => {
defaultBranch: 'main',
auth: { token: 'thing' },
logger: mockContext.logger,
gitAuthorInfo: {},
commitMessage: 'initial commit',
gitAuthorInfo: {
email: undefined,
name: undefined,
},
});
});
@@ -555,6 +567,7 @@ describe('publish:bitbucketServer', () => {
auth: { token: 'thing' },
logger: mockContext.logger,
defaultBranch: 'master',
commitMessage: 'initial commit',
gitAuthorInfo: { name: 'Test', email: 'example@example.com' },
});
});
@@ -574,7 +587,7 @@ describe('publish:bitbucketServer', () => {
],
},
scaffolder: {
defaultCommitMessage: 'Test commit message',
defaultCommitMessage: 'initial commit',
},
});
@@ -626,7 +639,7 @@ describe('publish:bitbucketServer', () => {
auth: { token: 'thing' },
logger: mockContext.logger,
defaultBranch: 'master',
commitMessage: 'Test commit message',
commitMessage: 'initial commit',
gitAuthorInfo: { email: undefined, name: undefined },
});
});
@@ -130,6 +130,9 @@ export function createPublishBitbucketServerAction(options: {
sourcePath?: string;
enableLFS?: boolean;
token?: string;
gitCommitMessage?: string;
gitAuthorName?: string;
gitAuthorEmail?: string;
}>({
id: 'publish:bitbucketServer',
description:
@@ -174,6 +177,21 @@ export function createPublishBitbucketServerAction(options: {
description:
'The token to use for authorization to BitBucket Server',
},
gitCommitMessage: {
title: 'Git Commit Message',
type: 'string',
description: `Sets the commit message on the repository. The default value is 'initial commit'`,
},
gitAuthorName: {
title: 'Author Name',
type: 'string',
description: `Sets the author name for the commit. The default value is 'Scaffolder'`,
},
gitAuthorEmail: {
title: 'Author Email',
type: 'string',
description: `Sets the author email for the commit.`,
},
},
},
output: {
@@ -197,6 +215,9 @@ export function createPublishBitbucketServerAction(options: {
defaultBranch = 'master',
repoVisibility = 'private',
enableLFS = false,
gitCommitMessage = 'initial commit',
gitAuthorName,
gitAuthorEmail,
} = ctx.input;
const { project, repo, host } = parseRepoUrl(repoUrl, integrations);
@@ -241,8 +262,12 @@ export function createPublishBitbucketServerAction(options: {
});
const gitAuthorInfo = {
name: config.getOptionalString('scaffolder.defaultAuthor.name'),
email: config.getOptionalString('scaffolder.defaultAuthor.email'),
name: gitAuthorName
? gitAuthorName
: config.getOptionalString('scaffolder.defaultAuthor.name'),
email: gitAuthorEmail
? gitAuthorEmail
: config.getOptionalString('scaffolder.defaultAuthor.email'),
};
const auth = authConfig.token
@@ -260,9 +285,9 @@ export function createPublishBitbucketServerAction(options: {
auth,
defaultBranch,
logger: ctx.logger,
commitMessage: config.getOptionalString(
'scaffolder.defaultCommitMessage',
),
commitMessage: gitCommitMessage
? gitCommitMessage
: config.getOptionalString('scaffolder.defaultCommitMessage'),
gitAuthorInfo,
});