From 3e1d7fac748863a12d332554fd9404a5d306965a Mon Sep 17 00:00:00 2001 From: Casey MacPherson Date: Wed, 18 Oct 2023 18:02:12 -0700 Subject: [PATCH] wiring up ability to set the project to to require all discussion on an MR to be resolved --- src/GitlabCli/Projects.psm1 | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/GitlabCli/Projects.psm1 b/src/GitlabCli/Projects.psm1 index c74f828..a175f06 100644 --- a/src/GitlabCli/Projects.psm1 +++ b/src/GitlabCli/Projects.psm1 @@ -441,6 +441,10 @@ function Update-GitlabProject { [string] $BuildsAccessLevel, + [Parameter(Mandatory=$false)] + [switch] + $OnlyAllowMergeIfAllDiscussionsAreResolved, + [Parameter(Mandatory=$false)] [string] $SiteUrl @@ -481,7 +485,16 @@ function Update-GitlabProject { $Query.builds_access_level = $BuildsAccessLevel } - if ($PSCmdlet.ShouldProcess("$($Project.PathWithNamespace)", "update project ($($Query | ConvertTo-Json))")) { + if($PSBoundParameters.ContainsKey("OnlyAllowMergeIfAllDiscussionsAreResolved") -and ` + $Project.OnlyAllowMergeIfAllDiscussionsAreResolved -ne $OnlyAllowMergeIfAllDiscussionsAreResolved + ) { + $Query.only_allow_merge_if_all_discussions_are_resolved = $OnlyAllowMergeIfAllDiscussionsAreResolved + } + + if($Query.Keys.Count -le 0) { + Write-Host "Nothing to update" + $Project + } elseif ($PSCmdlet.ShouldProcess("$($Project.PathWithNamespace)", "update project ($($Query | ConvertTo-Json))")) { Invoke-GitlabApi PUT "projects/$($Project.Id)" $Query -SiteUrl $SiteUrl | New-WrapperObject 'Gitlab.Project' }