diff --git a/plugins/scaffolder-backend-module-gitlab/report.api.md b/plugins/scaffolder-backend-module-gitlab/report.api.md index fa6c12e2e3..0cf1c41717 100644 --- a/plugins/scaffolder-backend-module-gitlab/report.api.md +++ b/plugins/scaffolder-backend-module-gitlab/report.api.md @@ -154,6 +154,11 @@ export function createPublishGitlabAction(options: { | undefined; topics?: string[] | undefined; visibility?: 'internal' | 'private' | 'public' | undefined; + only_allow_merge_if_all_discussions_are_resolved?: + | boolean + | undefined; + only_allow_merge_if_pipeline_succeeds?: boolean | undefined; + allow_merge_on_skipped_pipeline?: boolean | undefined; } | undefined; branches?: diff --git a/plugins/scaffolder-backend-module-gitlab/src/actions/gitlab.examples.ts b/plugins/scaffolder-backend-module-gitlab/src/actions/gitlab.examples.ts index f7a957c32e..3015850399 100644 --- a/plugins/scaffolder-backend-module-gitlab/src/actions/gitlab.examples.ts +++ b/plugins/scaffolder-backend-module-gitlab/src/actions/gitlab.examples.ts @@ -163,4 +163,43 @@ export const examples: TemplateExample[] = [ ], }), }, + { + description: + 'Initializes a GitLab repository with pipeline must succeed and allow merge on skipped pipeline settings.', + example: yaml.stringify({ + steps: [ + { + id: 'publish', + action: 'publish:gitlab', + name: 'Publish to GitLab', + input: { + repoUrl: 'gitlab.com?repo=project_name&owner=group_name', + settings: { + only_allow_merge_if_pipeline_succeeds: true, + allow_merge_on_skipped_pipeline: true, + }, + }, + }, + ], + }), + }, + { + description: + 'Initializes a GitLab repository with setting to require all threads (discussions) on merge request to be resolved before merging.', + example: yaml.stringify({ + steps: [ + { + id: 'publish', + action: 'publish:gitlab', + name: 'Publish to GitLab', + input: { + repoUrl: 'gitlab.com?repo=project_name&owner=group_name', + settings: { + only_allow_merge_if_all_discussions_are_resolved: true, + }, + }, + }, + ], + }), + }, ]; diff --git a/plugins/scaffolder-backend-module-gitlab/src/actions/gitlab.ts b/plugins/scaffolder-backend-module-gitlab/src/actions/gitlab.ts index 1c888cff09..957ac0aaf7 100644 --- a/plugins/scaffolder-backend-module-gitlab/src/actions/gitlab.ts +++ b/plugins/scaffolder-backend-module-gitlab/src/actions/gitlab.ts @@ -60,6 +60,9 @@ export function createPublishGitlabAction(options: { squash_option?: 'default_off' | 'default_on' | 'never' | 'always'; topics?: string[]; visibility?: 'private' | 'internal' | 'public'; + only_allow_merge_if_all_discussions_are_resolved?: boolean; + only_allow_merge_if_pipeline_succeeds?: boolean; + allow_merge_on_skipped_pipeline?: boolean; }; branches?: Array<{ name: string; @@ -199,6 +202,24 @@ export function createPublishGitlabAction(options: { type: 'string', enum: ['private', 'public', 'internal'], }, + only_allow_merge_if_all_discussions_are_resolved: { + title: 'All threads must be resolved', + description: + 'Set whether merge requests can only be merged when all the discussions are resolved.', + type: 'boolean', + }, + only_allow_merge_if_pipeline_succeeds: { + title: 'Pipelines must succeed', + description: + 'Set whether merge requests can only be merged with successful pipelines. This setting is named Pipelines must succeed in the project settings.', + type: 'boolean', + }, + allow_merge_on_skipped_pipeline: { + title: 'Skipped pipelines are considered successful', + description: + 'Set whether or not merge requests can be merged with skipped jobs.', + type: 'boolean', + }, }, }, branches: {