diff --git a/src/GitlabCli/GitlabCli.psd1 b/src/GitlabCli/GitlabCli.psd1 index 2079d68..ae4193c 100644 --- a/src/GitlabCli/GitlabCli.psd1 +++ b/src/GitlabCli/GitlabCli.psd1 @@ -80,7 +80,7 @@ # Projects 'Get-GitlabProject' - 'Get-GitlabProjectAsTriggerPipeline' + 'ConvertTo-Triggers' 'New-GitlabProject' 'Update-GitlabProject' 'Move-GitlabProject' diff --git a/src/GitlabCli/Projects.psm1 b/src/GitlabCli/Projects.psm1 index 5c66163..9dbbf5e 100644 --- a/src/GitlabCli/Projects.psm1 +++ b/src/GitlabCli/Projects.psm1 @@ -174,10 +174,15 @@ function Get-GitlabProject { Get-FilteredObject $Select } -function Get-GitlabProjectAsTriggerPipeline { +function ConvertTo-Triggers { param ( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] - $InputObject + $InputObject, + + [Parameter(Mandatory=$false)] + [ValidateSet('', 'depend')] + [string] + $Strategy = 'depend' ) Begin { $Yaml = @" @@ -192,14 +197,20 @@ stages: continue } $Projects += $Object.ProjectId - $Yaml += "`n`n" $Yaml += @" + + $($Object.Name): stage: trigger trigger: project: $($Object.PathWithNamespace) - strategy: depend "@ + if ($Strategy) { + $Yaml += @" + + strategy: $Strategy +"@ + } } } End {