This repository was archived by the owner on Sep 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathGet-GitLabProjectRepositoryTag.ps1
More file actions
52 lines (47 loc) · 1.55 KB
/
Copy pathGet-GitLabProjectRepositoryTag.ps1
File metadata and controls
52 lines (47 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
function Get-GitLabProjectRepositoryTag
{
<#
.SYNOPSIS
Get tags on repository.
.DESCRIPTION
Get a list of repository tags from a project
only specified tag is returned when -TagName is passed.
.EXAMPLE
Get-GitLabProjectRepositoryTag -ProjectID 20
---------------------------------------------------------------
gets all tags for the repository in project 20
.EXAMPLE
Get-GitLabProjectRepositoryTag -ProjectID 20 -TagName 'v1.0.0'
---------------------------------------------------------------
gets tag 'v1.0.0' for the repository in project 20
#>
[CmdletBinding(defaultParameterSetName = 'AllTags')]
[Alias()]
[OutputType()]
Param
(
# The ID of the project
[Parameter(Mandatory = $true, HelpMessage = 'The id of a project')]
[Alias('ID')]
[String]$ProjectID,
#The name of the tag
[Parameter(ParameterSetName = 'SingleTag',
HelpMessage = 'Tag Name',
Mandatory = $true)]
[Alias('Tag','tag_name')]
[string]$TagName,
# Existing GitlabConnector Object, can be retrieved with Get-GitlabConnect
[Parameter(HelpMessage = 'Specify Existing GitlabConnector',
Mandatory = $false,
DontShow = $true)]
[psobject]$GitlabConnect = (Get-GitlabConnect)
)
$httpmethod = 'get'
$apiurl = "projects/$([System.Web.HttpUtility]::UrlEncode($projectId))/repository/tags"
$parameters = @{}
if($PSCmdlet.ParameterSetName -like 'SingleTag')
{
$apiurl += "/$TagName"
}
$GitlabConnect.callapi($apiurl,$httpmethod,$parameters)
}