From f7cfcea8635aba2d4c44a2e6205de103214ea5d9 Mon Sep 17 00:00:00 2001 From: Chris Peterson Date: Thu, 19 Oct 2023 07:10:52 -0700 Subject: [PATCH] Some consistency tweaks and bump version to publish --- src/GitlabCli/GitlabCli.psd1 | 4 ++-- src/GitlabCli/Projects.psm1 | 35 +++++++++++++++-------------------- 2 files changed, 17 insertions(+), 22 deletions(-) diff --git a/src/GitlabCli/GitlabCli.psd1 b/src/GitlabCli/GitlabCli.psd1 index 72c7ebd..cfaf775 100644 --- a/src/GitlabCli/GitlabCli.psd1 +++ b/src/GitlabCli/GitlabCli.psd1 @@ -1,11 +1,11 @@ @{ - ModuleVersion = '1.104.1' + ModuleVersion = '1.105.0' PrivateData = @{ PSData = @{ LicenseUri = 'https://github.com/chris-peterson/pwsh-gitlab/blob/main/LICENSE' ProjectUri = 'https://github.com/chris-peterson/pwsh-gitlab' - ReleaseNotes = 'Audit event tweaks' + ReleaseNotes = 'https://github.com/chris-peterson/pwsh-gitlab/pull/85' } } diff --git a/src/GitlabCli/Projects.psm1 b/src/GitlabCli/Projects.psm1 index a175f06..bc91f1a 100644 --- a/src/GitlabCli/Projects.psm1 +++ b/src/GitlabCli/Projects.psm1 @@ -396,33 +396,33 @@ function Update-GitlabProject { [string] $ProjectId = '.', - [Parameter(Mandatory=$false)] + [Parameter()] [ValidateSet('private', 'internal', 'public')] [string] $Visibility, - [Parameter(Mandatory=$false)] + [Parameter()] [string] $Name, - [Parameter(Mandatory=$false)] + [Parameter()] [string] $Path, - [Parameter(Mandatory=$false)] + [Parameter()] [string] $DefaultBranch, - [Parameter(Mandatory=$false)] + [Parameter()] [string []] $Topics, - [Parameter(Mandatory=$false)] + [Parameter()] [ValidateSet('fetch', 'clone')] [string] $BuildGitStrategy, - [Parameter(Mandatory=$false)] + [Parameter()] [uint] $CiDefaultGitDepth, @@ -431,21 +431,22 @@ function Update-GitlabProject { [object] $CiForwardDeployment, - [Parameter(Mandatory=$false)] + [Parameter()] [ValidateSet('disabled', 'private', 'enabled')] [string] $RepositoryAccessLevel, - [Parameter(Mandatory=$false)] + [Parameter()] [ValidateSet('disabled', 'private', 'enabled')] [string] $BuildsAccessLevel, - [Parameter(Mandatory=$false)] - [switch] + [Parameter()] + [ValidateSet($null, 'true', 'false')] + [object] $OnlyAllowMergeIfAllDiscussionsAreResolved, - [Parameter(Mandatory=$false)] + [Parameter()] [string] $SiteUrl ) @@ -484,17 +485,11 @@ function Update-GitlabProject { if ($BuildsAccessLevel) { $Query.builds_access_level = $BuildsAccessLevel } - - if($PSBoundParameters.ContainsKey("OnlyAllowMergeIfAllDiscussionsAreResolved") -and ` - $Project.OnlyAllowMergeIfAllDiscussionsAreResolved -ne $OnlyAllowMergeIfAllDiscussionsAreResolved - ) { + if ($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))")) { + if ($PSCmdlet.ShouldProcess("$($Project.PathWithNamespace)", "update project ($($Query | ConvertTo-Json))")) { Invoke-GitlabApi PUT "projects/$($Project.Id)" $Query -SiteUrl $SiteUrl | New-WrapperObject 'Gitlab.Project' }