add ability to specify author name and email for bitbucket commits

Signed-off-by: mbruhin <47482924+mbruhin@users.noreply.github.com>
This commit is contained in:
mbruhin
2024-03-12 13:54:22 -06:00
parent 5c3e1865a8
commit 0e48aaf690
2 changed files with 25 additions and 2 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-scaffolder-backend-module-bitbucket-server': patch
---
Added an option to specify a commit author by adding gitAuthorName and gitAuthorEmail options to the `publish:bitbucketServer:pull-request` action
@@ -220,6 +220,8 @@ export function createPublishBitbucketServerPullRequestAction(options: {
targetBranch?: string;
sourceBranch: string;
token?: string;
gitAuthorName?: string;
gitAuthorEmail?: string;
}>({
id: 'publish:bitbucketServer:pull-request',
schema: {
@@ -257,6 +259,16 @@ export function createPublishBitbucketServerPullRequestAction(options: {
description:
'The token to use for authorization to BitBucket Server',
},
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: {
@@ -276,6 +288,8 @@ export function createPublishBitbucketServerPullRequestAction(options: {
description,
targetBranch = 'master',
sourceBranch,
gitAuthorName,
gitAuthorEmail,
} = ctx.input;
const { project, repo, host } = parseRepoUrl(repoUrl, integrations);
@@ -354,8 +368,12 @@ export function createPublishBitbucketServerPullRequestAction(options: {
};
const gitAuthorInfo = {
name: config.getOptionalString('scaffolder.defaultAuthor.name'),
email: config.getOptionalString('scaffolder.defaultAuthor.email'),
name:
gitAuthorName ||
config.getOptionalString('scaffolder.defaultAuthor.name'),
email:
gitAuthorEmail ||
config.getOptionalString('scaffolder.defaultAuthor.email'),
};
const tempDir = await ctx.createTemporaryDirectory();