Skip to content

Commit

Permalink
Add cmdlet to remove a project
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-peterson committed Aug 24, 2024
1 parent 3bb826d commit 08d718f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
Binary file modified assets/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions src/GitlabCli/GitlabCli.psd1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@{
ModuleVersion = '1.115.1'
ModuleVersion = '1.116.0'

RequiredModules = @('powershell-yaml')

Expand Down Expand Up @@ -27,8 +27,7 @@
ExternalModuleDependencies = @('powershell-yaml')
ReleaseNotes =
@'
* https://github.com/chris-peterson/pwsh-gitlab/pull/91
* https://github.com/chris-peterson/pwsh-gitlab/pull/92
https://github.com/chris-peterson/pwsh-gitlab/issues/82
'@
}
}
Expand Down Expand Up @@ -138,6 +137,7 @@
'Move-GitlabProject'
'New-GitlabProject'
'New-GitlabProjectHook'
'Remove-GitlabProject'
'Remove-GitlabProjectHook'
'Remove-GitlabProjectVariable'
'Rename-GitlabProject'
Expand Down
21 changes: 21 additions & 0 deletions src/GitlabCli/Projects.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -794,3 +794,24 @@ function Add-GitlabGroupToProject {
}
}
}

function Remove-GitlabProject {
[CmdletBinding(SupportsShouldProcess, ConfirmImpact='High')]
param (
[Parameter(Position=0, Mandatory, ValueFromPipelineByPropertyName)]
[string]
$ProjectId,

[Parameter()]
[string]
$SiteUrl
)

$Project = Get-GitlabProject -ProjectId $ProjectId

if ($PSCmdlet.ShouldProcess("$($Project.PathWithNamespace)", "remove project")) {
# https://docs.gitlab.com/ee/api/projects.html#delete-project
Invoke-GitlabApi DELETE "projects/$($ProjectId)" -SiteUrl $SiteUrl | Out-Null
Write-Host "Removed $($Project.PathWithNamespace)"
}
}

0 comments on commit 08d718f

Please sign in to comment.