@@ -316,11 +316,16 @@ function Remove-GitHubLabel
316
316
Remove-GitHubLabel -OwnerName Microsoft -RepositoryName PowerShellForGitHub -Name TestLabel
317
317
318
318
Removes the label called "TestLabel" from the PowerShellForGitHub project.
319
+
320
+
.EXAMPLE
321
+
Remove-GitHubLabel -OwnerName Microsoft -RepositoryName PowerShellForGitHub -Name TestLabel -Confirm:$false
322
+
323
+
Removes the label called "TestLabel" from the PowerShellForGitHub project. Will not prompt for confirmation, as -Confirm:$false was specified.
319
324
#>
320
325
[CmdletBinding(
321
326
SupportsShouldProcess,
322
-
DefaultParameterSetName='Elements')]
323
-
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess", "", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
327
+
DefaultParameterSetName='Elements',
328
+
ConfirmImpact="High")]
324
329
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSReviewUnusedParameter", "", Justification="One or more parameters (like NoStatus) are only referenced by helper methods which get access to it from the stack via Get-Variable -Scope 1.")]
325
330
[Alias('Delete-GitHubLabel')]
326
331
param(
@@ -356,18 +361,21 @@ function Remove-GitHubLabel
356
361
'RepositoryName' = (Get-PiiSafeString -PlainText $RepositoryName)
357
362
}
358
363
359
-
$params = @{
360
-
'UriFragment' = "repos/$OwnerName/$RepositoryName/labels/$Name"
361
-
'Method' = 'Delete'
362
-
'Description' = "Deleting label $Name from $RepositoryName"
363
-
'AcceptHeader' = 'application/vnd.github.symmetra-preview+json'
364
-
'AccessToken' = $AccessToken
365
-
'TelemetryEventName' = $MyInvocation.MyCommand.Name
366
-
'TelemetryProperties' = $telemetryProperties
367
-
'NoStatus' = (Resolve-ParameterWithDefaultConfigurationValue -Name NoStatus -ConfigValueName DefaultNoStatus)
368
-
}
364
+
if ($PSCmdlet.ShouldProcess($Name, "Remove label"))
365
+
{
366
+
$params = @{
367
+
'UriFragment' = "repos/$OwnerName/$RepositoryName/labels/$Name"
368
+
'Method' = 'Delete'
369
+
'Description' = "Deleting label $Name from $RepositoryName"
370
+
'AcceptHeader' = 'application/vnd.github.symmetra-preview+json'
371
+
'AccessToken' = $AccessToken
372
+
'TelemetryEventName' = $MyInvocation.MyCommand.Name
373
+
'TelemetryProperties' = $telemetryProperties
374
+
'NoStatus' = (Resolve-ParameterWithDefaultConfigurationValue -Name NoStatus -ConfigValueName DefaultNoStatus)
375
+
}
369
376
370
-
return Invoke-GHRestMethod @params
377
+
return Invoke-GHRestMethod @params
378
+
}
371
379
}
372
380
373
381
function Update-GitHubLabel
@@ -614,7 +622,7 @@ function Set-GitHubLabel
614
622
if ($labelName -notin $labelNames)
615
623
{
616
624
# Remove label if it exists but is not in desired label list
617
-
$null = Remove-GitHubLabel -Name $labelName @commonParams
625
+
$null = Remove-GitHubLabel -Name $labelName @commonParams -Confirm:$false
618
626
}
619
627
}
620
628
}
@@ -865,11 +873,16 @@ function Remove-GitHubIssueLabel
865
873
Remove-GitHubIssueLabel -OwnerName Microsoft -RepositoryName PowerShellForGitHub -Name TestLabel -Issue 1
866
874
867
875
Removes the label called "TestLabel" from issue 1 in the PowerShellForGitHub project.
876
+
877
+
.EXAMPLE
878
+
Remove-GitHubIssueLabel -OwnerName Microsoft -RepositoryName PowerShellForGitHub -Name TestLabel -Issue 1 -Confirm:$false
879
+
880
+
Removes the label called "TestLabel" from issue 1 in the PowerShellForGitHub project. Will not prompt for confirmation, as -Confirm:$false was specified.
868
881
#>
869
882
[CmdletBinding(
870
883
SupportsShouldProcess,
871
-
DefaultParameterSetName='Elements')]
872
-
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess", "", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
884
+
DefaultParameterSetName='Elements',
885
+
ConfirmImpact="High")]
873
886
[Alias('Delete-GitHubLabel')]
874
887
param(
875
888
[Parameter(Mandatory, ParameterSetName='Elements')]
@@ -915,18 +928,21 @@ function Remove-GitHubIssueLabel
915
928
$description = "Deleting all labels from issue $Issue in $RepositoryName"
916
929
}
917
930
918
-
$params = @{
919
-
'UriFragment' = "/repos/$OwnerName/$RepositoryName/issues/$Issue/labels/$Name"
920
-
'Method' = 'Delete'
921
-
'Description' = $description
922
-
'AcceptHeader' = 'application/vnd.github.symmetra-preview+json'
923
-
'AccessToken' = $AccessToken
924
-
'TelemetryEventName' = $MyInvocation.MyCommand.Name
925
-
'TelemetryProperties' = $telemetryProperties
926
-
'NoStatus' = (Resolve-ParameterWithDefaultConfigurationValue -Name NoStatus -ConfigValueName DefaultNoStatus)
927
-
}
931
+
if ($PSCmdlet.ShouldProcess($Name, "Remove label"))
932
+
{
933
+
$params = @{
934
+
'UriFragment' = "/repos/$OwnerName/$RepositoryName/issues/$Issue/labels/$Name"
935
+
'Method' = 'Delete'
936
+
'Description' = $description
937
+
'AcceptHeader' = 'application/vnd.github.symmetra-preview+json'
938
+
'AccessToken' = $AccessToken
939
+
'TelemetryEventName' = $MyInvocation.MyCommand.Name
940
+
'TelemetryProperties' = $telemetryProperties
941
+
'NoStatus' = (Resolve-ParameterWithDefaultConfigurationValue -Name NoStatus -ConfigValueName DefaultNoStatus)
942
+
}
928
943
929
-
return Invoke-GHRestMethod @params
944
+
return Invoke-GHRestMethod @params
945
+
}
930
946
}
931
947
932
948
# A set of labels that a project might want to initially populate their repository with
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4