Merge pull request #23521 from mbruhin/add-author-to-bitbucket-pull-request-scaffolder

add ability to specify author name and email for bitbucket commits
This commit is contained in:
Ben Lambert
2024-03-19 13:44:42 +01:00
committed by GitHub
3 changed files with 27 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
@@ -45,6 +45,8 @@ export function createPublishBitbucketServerPullRequestAction(options: {
targetBranch?: string | undefined;
sourceBranch: string;
token?: string | undefined;
gitAuthorName?: string | undefined;
gitAuthorEmail?: string | undefined;
},
JsonObject
>;
@@ -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();