From 0e48aaf690620b5c74f15ea038db530cce8b482b Mon Sep 17 00:00:00 2001 From: mbruhin <47482924+mbruhin@users.noreply.github.com> Date: Tue, 12 Mar 2024 13:54:22 -0600 Subject: [PATCH] add ability to specify author name and email for bitbucket commits Signed-off-by: mbruhin <47482924+mbruhin@users.noreply.github.com> --- .changeset/fair-fishes-marry.md | 5 +++++ .../src/actions/bitbucketServerPullRequest.ts | 22 +++++++++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 .changeset/fair-fishes-marry.md diff --git a/.changeset/fair-fishes-marry.md b/.changeset/fair-fishes-marry.md new file mode 100644 index 0000000000..8f315f0fcb --- /dev/null +++ b/.changeset/fair-fishes-marry.md @@ -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 diff --git a/plugins/scaffolder-backend-module-bitbucket-server/src/actions/bitbucketServerPullRequest.ts b/plugins/scaffolder-backend-module-bitbucket-server/src/actions/bitbucketServerPullRequest.ts index fc123f0b80..80412ca413 100644 --- a/plugins/scaffolder-backend-module-bitbucket-server/src/actions/bitbucketServerPullRequest.ts +++ b/plugins/scaffolder-backend-module-bitbucket-server/src/actions/bitbucketServerPullRequest.ts @@ -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();