From 4baf8a4ece338045f3a2ad919242661919cc5b14 Mon Sep 17 00:00:00 2001 From: Aisha Saini Date: Tue, 3 May 2022 15:40:24 +0100 Subject: [PATCH] Update GitLab MR Action to allow source branch to be deleted on merge Signed-off-by: Aisha Saini Signed-off-by: asaini1 --- .changeset/old-onions-hear.md | 5 +++++ .../actions/builtin/publish/gitlabMergeRequest.ts | 12 +++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 .changeset/old-onions-hear.md diff --git a/.changeset/old-onions-hear.md b/.changeset/old-onions-hear.md new file mode 100644 index 0000000000..82dcc09190 --- /dev/null +++ b/.changeset/old-onions-hear.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-scaffolder-backend': minor +--- + +Update GitLab Merge Request Action to allow source branch to be deleted diff --git a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/publish/gitlabMergeRequest.ts b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/publish/gitlabMergeRequest.ts index f717a7a0c6..fe94f5ae53 100644 --- a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/publish/gitlabMergeRequest.ts +++ b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/publish/gitlabMergeRequest.ts @@ -42,6 +42,7 @@ export const createPublishGitlabMergeRequestAction = (options: { token?: string; /** @deprecated Use projectPath instead */ projectid?: string; + removeSourceBranch?: boolean; }>({ id: 'publish:gitlab:merge-request', schema: { @@ -85,6 +86,12 @@ export const createPublishGitlabMergeRequestAction = (options: { type: 'string', description: 'The token to use for authorization to GitLab', }, + removeSourceBranch: { + title: 'Delete source branch', + type: 'boolean', + description: + 'Option to delete source branch once the MR has been merged. Default: false', + }, }, }, output: { @@ -187,7 +194,10 @@ export const createPublishGitlabMergeRequestAction = (options: { destinationBranch, String(defaultBranch), ctx.input.title, - { description: ctx.input.description }, + { + description: ctx.input.description, + removeSourceBranch: ctx.input.removeSourceBranch, + }, ).then((mergeRequest: { web_url: string }) => { return mergeRequest.web_url; });