diff --git a/.changeset/fair-fishes-marry.md b/.changeset/fair-fishes-marry.md new file mode 100644 index 0000000000..92fa45fc53 --- /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/api-report.md b/plugins/scaffolder-backend-module-bitbucket-server/api-report.md index 3e2e3dffe4..4d75a3dbda 100644 --- a/plugins/scaffolder-backend-module-bitbucket-server/api-report.md +++ b/plugins/scaffolder-backend-module-bitbucket-server/api-report.md @@ -45,6 +45,8 @@ export function createPublishBitbucketServerPullRequestAction(options: { targetBranch?: string | undefined; sourceBranch: string; token?: string | undefined; + gitAuthorName?: string | undefined; + gitAuthorEmail?: string | undefined; }, JsonObject >; 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();