BREAKING CHANGE: Add confirmation prompts and examples for Remove- functions (#174)
Updates all Remove-* functions to set `ConfirmImpact='High'`, wraps the execution in `$PSCmdlet.ShouldProcess()`, and adds examples which show how to call the functions with `-Confirm:$false` to avoid the confirmation prompt. ## Breaking Change This will be considered a breaking change for anyone using this module in an automated, scripted basis and calling any Remove-* methods. They will need to add `-Confirm:$false` to those API calls, similar to what was done for the unit tests. Fixes #171
This commit is contained in:
Родитель
21e6139983
Коммит
a6a27aa0aa
|
@ -328,11 +328,16 @@ function Remove-GithubAssignee
|
|||
Remove-GithubAssignee -OwnerName Microsoft -RepositoryName PowerShellForGitHub -Assignee $assignees
|
||||
|
||||
Lists the available assignees for issues from the Microsoft\PowerShellForGitHub project.
|
||||
|
||||
.EXAMPLE
|
||||
Remove-GithubAssignee -OwnerName Microsoft -RepositoryName PowerShellForGitHub -Assignee $assignees -Confirm:$false
|
||||
|
||||
Lists the available assignees for issues from the Microsoft\PowerShellForGitHub project. Will not prompt for confirmation, as -Confirm:$false was specified.
|
||||
#>
|
||||
[CmdletBinding(
|
||||
SupportsShouldProcess,
|
||||
DefaultParameterSetName='Elements')]
|
||||
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess", "", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
|
||||
DefaultParameterSetName='Elements',
|
||||
ConfirmImpact="High")]
|
||||
[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.")]
|
||||
param(
|
||||
[Parameter(ParameterSetName='Elements')]
|
||||
|
@ -374,17 +379,20 @@ function Remove-GithubAssignee
|
|||
'assignees' = $Assignee
|
||||
}
|
||||
|
||||
$params = @{
|
||||
'UriFragment' = "repos/$OwnerName/$RepositoryName/issues/$Issue/assignees"
|
||||
'Body' = (ConvertTo-Json -InputObject $hashBody)
|
||||
'Method' = 'Delete'
|
||||
'Description' = "Removing assignees from issue $Issue for $RepositoryName"
|
||||
'AccessToken' = $AccessToken
|
||||
'AcceptHeader' = 'application/vnd.github.symmetra-preview+json'
|
||||
'TelemetryEventName' = $MyInvocation.MyCommand.Name
|
||||
'TelemetryProperties' = $telemetryProperties
|
||||
'NoStatus' = (Resolve-ParameterWithDefaultConfigurationValue -Name NoStatus -ConfigValueName DefaultNoStatus)
|
||||
}
|
||||
if ($PSCmdlet.ShouldProcess($Assignee -join ', ', "Remove assignee(s)"))
|
||||
{
|
||||
$params = @{
|
||||
'UriFragment' = "repos/$OwnerName/$RepositoryName/issues/$Issue/assignees"
|
||||
'Body' = (ConvertTo-Json -InputObject $hashBody)
|
||||
'Method' = 'Delete'
|
||||
'Description' = "Removing assignees from issue $Issue for $RepositoryName"
|
||||
'AccessToken' = $AccessToken
|
||||
'AcceptHeader' = 'application/vnd.github.symmetra-preview+json'
|
||||
'TelemetryEventName' = $MyInvocation.MyCommand.Name
|
||||
'TelemetryProperties' = $telemetryProperties
|
||||
'NoStatus' = (Resolve-ParameterWithDefaultConfigurationValue -Name NoStatus -ConfigValueName DefaultNoStatus)
|
||||
}
|
||||
|
||||
return Invoke-GHRestMethod @params
|
||||
return Invoke-GHRestMethod @params
|
||||
}
|
||||
}
|
||||
|
|
|
@ -452,12 +452,17 @@ function Remove-GitHubComment
|
|||
Remove-GitHubComment -OwnerName Microsoft -RepositoryName PowerShellForGitHub -CommentID 1
|
||||
|
||||
Deletes a Github comment from the Microsoft\PowerShellForGitHub project.
|
||||
|
||||
.EXAMPLE
|
||||
Remove-GitHubComment -OwnerName Microsoft -RepositoryName PowerShellForGitHub -CommentID 1 -Confirm:$false
|
||||
|
||||
Deletes a Github comment from the Microsoft\PowerShellForGitHub project without prompting confirmation.
|
||||
#>
|
||||
[CmdletBinding(
|
||||
SupportsShouldProcess,
|
||||
DefaultParameterSetName='Elements')]
|
||||
DefaultParameterSetName='Elements',
|
||||
ConfirmImpact="High")]
|
||||
[Alias('Delete-GitHubComment')]
|
||||
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess", "", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
|
||||
[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.")]
|
||||
param(
|
||||
[Parameter(ParameterSetName='Elements')]
|
||||
|
@ -491,16 +496,19 @@ function Remove-GitHubComment
|
|||
'CommentID' = (Get-PiiSafeString -PlainText $CommentID)
|
||||
}
|
||||
|
||||
$params = @{
|
||||
'UriFragment' = "repos/$OwnerName/$RepositoryName/issues/comments/$CommentID"
|
||||
'Method' = 'Delete'
|
||||
'Description' = "Removing comment $CommentID for $RepositoryName"
|
||||
'AccessToken' = $AccessToken
|
||||
'TelemetryEventName' = $MyInvocation.MyCommand.Name
|
||||
'TelemetryProperties' = $telemetryProperties
|
||||
'NoStatus' = (Resolve-ParameterWithDefaultConfigurationValue -Name NoStatus -ConfigValueName DefaultNoStatus)
|
||||
}
|
||||
if ($PSCmdlet.ShouldProcess($CommentID, "Remove comment"))
|
||||
{
|
||||
$params = @{
|
||||
'UriFragment' = "repos/$OwnerName/$RepositoryName/issues/comments/$CommentID"
|
||||
'Method' = 'Delete'
|
||||
'Description' = "Removing comment $CommentID for $RepositoryName"
|
||||
'AccessToken' = $AccessToken
|
||||
'TelemetryEventName' = $MyInvocation.MyCommand.Name
|
||||
'TelemetryProperties' = $telemetryProperties
|
||||
'NoStatus' = (Resolve-ParameterWithDefaultConfigurationValue -Name NoStatus -ConfigValueName DefaultNoStatus)
|
||||
}
|
||||
|
||||
return Invoke-GHRestMethod @params
|
||||
return Invoke-GHRestMethod @params
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -316,11 +316,16 @@ function Remove-GitHubLabel
|
|||
Remove-GitHubLabel -OwnerName Microsoft -RepositoryName PowerShellForGitHub -Name TestLabel
|
||||
|
||||
Removes the label called "TestLabel" from the PowerShellForGitHub project.
|
||||
|
||||
.EXAMPLE
|
||||
Remove-GitHubLabel -OwnerName Microsoft -RepositoryName PowerShellForGitHub -Name TestLabel -Confirm:$false
|
||||
|
||||
Removes the label called "TestLabel" from the PowerShellForGitHub project. Will not prompt for confirmation, as -Confirm:$false was specified.
|
||||
#>
|
||||
[CmdletBinding(
|
||||
SupportsShouldProcess,
|
||||
DefaultParameterSetName='Elements')]
|
||||
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess", "", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
|
||||
DefaultParameterSetName='Elements',
|
||||
ConfirmImpact="High")]
|
||||
[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.")]
|
||||
[Alias('Delete-GitHubLabel')]
|
||||
param(
|
||||
|
@ -356,18 +361,21 @@ function Remove-GitHubLabel
|
|||
'RepositoryName' = (Get-PiiSafeString -PlainText $RepositoryName)
|
||||
}
|
||||
|
||||
$params = @{
|
||||
'UriFragment' = "repos/$OwnerName/$RepositoryName/labels/$Name"
|
||||
'Method' = 'Delete'
|
||||
'Description' = "Deleting label $Name from $RepositoryName"
|
||||
'AcceptHeader' = 'application/vnd.github.symmetra-preview+json'
|
||||
'AccessToken' = $AccessToken
|
||||
'TelemetryEventName' = $MyInvocation.MyCommand.Name
|
||||
'TelemetryProperties' = $telemetryProperties
|
||||
'NoStatus' = (Resolve-ParameterWithDefaultConfigurationValue -Name NoStatus -ConfigValueName DefaultNoStatus)
|
||||
}
|
||||
if ($PSCmdlet.ShouldProcess($Name, "Remove label"))
|
||||
{
|
||||
$params = @{
|
||||
'UriFragment' = "repos/$OwnerName/$RepositoryName/labels/$Name"
|
||||
'Method' = 'Delete'
|
||||
'Description' = "Deleting label $Name from $RepositoryName"
|
||||
'AcceptHeader' = 'application/vnd.github.symmetra-preview+json'
|
||||
'AccessToken' = $AccessToken
|
||||
'TelemetryEventName' = $MyInvocation.MyCommand.Name
|
||||
'TelemetryProperties' = $telemetryProperties
|
||||
'NoStatus' = (Resolve-ParameterWithDefaultConfigurationValue -Name NoStatus -ConfigValueName DefaultNoStatus)
|
||||
}
|
||||
|
||||
return Invoke-GHRestMethod @params
|
||||
return Invoke-GHRestMethod @params
|
||||
}
|
||||
}
|
||||
|
||||
function Update-GitHubLabel
|
||||
|
@ -614,7 +622,7 @@ function Set-GitHubLabel
|
|||
if ($labelName -notin $labelNames)
|
||||
{
|
||||
# Remove label if it exists but is not in desired label list
|
||||
$null = Remove-GitHubLabel -Name $labelName @commonParams
|
||||
$null = Remove-GitHubLabel -Name $labelName @commonParams -Confirm:$false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -865,11 +873,16 @@ function Remove-GitHubIssueLabel
|
|||
Remove-GitHubIssueLabel -OwnerName Microsoft -RepositoryName PowerShellForGitHub -Name TestLabel -Issue 1
|
||||
|
||||
Removes the label called "TestLabel" from issue 1 in the PowerShellForGitHub project.
|
||||
|
||||
.EXAMPLE
|
||||
Remove-GitHubIssueLabel -OwnerName Microsoft -RepositoryName PowerShellForGitHub -Name TestLabel -Issue 1 -Confirm:$false
|
||||
|
||||
Removes the label called "TestLabel" from issue 1 in the PowerShellForGitHub project. Will not prompt for confirmation, as -Confirm:$false was specified.
|
||||
#>
|
||||
[CmdletBinding(
|
||||
SupportsShouldProcess,
|
||||
DefaultParameterSetName='Elements')]
|
||||
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess", "", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
|
||||
DefaultParameterSetName='Elements',
|
||||
ConfirmImpact="High")]
|
||||
[Alias('Delete-GitHubLabel')]
|
||||
param(
|
||||
[Parameter(Mandatory, ParameterSetName='Elements')]
|
||||
|
@ -915,18 +928,21 @@ function Remove-GitHubIssueLabel
|
|||
$description = "Deleting all labels from issue $Issue in $RepositoryName"
|
||||
}
|
||||
|
||||
$params = @{
|
||||
'UriFragment' = "/repos/$OwnerName/$RepositoryName/issues/$Issue/labels/$Name"
|
||||
'Method' = 'Delete'
|
||||
'Description' = $description
|
||||
'AcceptHeader' = 'application/vnd.github.symmetra-preview+json'
|
||||
'AccessToken' = $AccessToken
|
||||
'TelemetryEventName' = $MyInvocation.MyCommand.Name
|
||||
'TelemetryProperties' = $telemetryProperties
|
||||
'NoStatus' = (Resolve-ParameterWithDefaultConfigurationValue -Name NoStatus -ConfigValueName DefaultNoStatus)
|
||||
}
|
||||
if ($PSCmdlet.ShouldProcess($Name, "Remove label"))
|
||||
{
|
||||
$params = @{
|
||||
'UriFragment' = "/repos/$OwnerName/$RepositoryName/issues/$Issue/labels/$Name"
|
||||
'Method' = 'Delete'
|
||||
'Description' = $description
|
||||
'AcceptHeader' = 'application/vnd.github.symmetra-preview+json'
|
||||
'AccessToken' = $AccessToken
|
||||
'TelemetryEventName' = $MyInvocation.MyCommand.Name
|
||||
'TelemetryProperties' = $telemetryProperties
|
||||
'NoStatus' = (Resolve-ParameterWithDefaultConfigurationValue -Name NoStatus -ConfigValueName DefaultNoStatus)
|
||||
}
|
||||
|
||||
return Invoke-GHRestMethod @params
|
||||
return Invoke-GHRestMethod @params
|
||||
}
|
||||
}
|
||||
|
||||
# A set of labels that a project might want to initially populate their repository with
|
||||
|
|
|
@ -500,12 +500,17 @@ function Remove-GitHubMilestone
|
|||
Remove-GitHubMilestone -OwnerName Microsoft -RepositoryName PowerShellForGitHub -Milestone 1
|
||||
|
||||
Deletes a Github milestone from the Microsoft\PowerShellForGitHub project.
|
||||
|
||||
.EXAMPLE
|
||||
Remove-GitHubMilestone -OwnerName Microsoft -RepositoryName PowerShellForGitHub -Milestone 1 -Confirm:$false
|
||||
|
||||
Deletes a Github milestone from the Microsoft\PowerShellForGitHub project. Will not prompt for confirmation, as -Confirm:$false was specified.
|
||||
#>
|
||||
[CmdletBinding(
|
||||
SupportsShouldProcess,
|
||||
DefaultParameterSetName='Elements')]
|
||||
DefaultParameterSetName='Elements',
|
||||
ConfirmImpact="High")]
|
||||
[Alias('Delete-GitHubMilestone')]
|
||||
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess", "", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
|
||||
[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.")]
|
||||
param(
|
||||
[Parameter(Mandatory, ParameterSetName='Elements')]
|
||||
|
@ -538,15 +543,18 @@ function Remove-GitHubMilestone
|
|||
'Milestone' = (Get-PiiSafeString -PlainText $Milestone)
|
||||
}
|
||||
|
||||
$params = @{
|
||||
'UriFragment' = "repos/$OwnerName/$RepositoryName/milestones/$Milestone"
|
||||
'Method' = 'Delete'
|
||||
'Description' = "Removing milestone $Milestone for $RepositoryName"
|
||||
'AccessToken' = $AccessToken
|
||||
'TelemetryEventName' = $MyInvocation.MyCommand.Name
|
||||
'TelemetryProperties' = $telemetryProperties
|
||||
'NoStatus' = (Resolve-ParameterWithDefaultConfigurationValue -Name NoStatus -ConfigValueName DefaultNoStatus)
|
||||
}
|
||||
if ($PSCmdlet.ShouldProcess($Milestone, "Remove milestone"))
|
||||
{
|
||||
$params = @{
|
||||
'UriFragment' = "repos/$OwnerName/$RepositoryName/milestones/$Milestone"
|
||||
'Method' = 'Delete'
|
||||
'Description' = "Removing milestone $Milestone for $RepositoryName"
|
||||
'AccessToken' = $AccessToken
|
||||
'TelemetryEventName' = $MyInvocation.MyCommand.Name
|
||||
'TelemetryProperties' = $telemetryProperties
|
||||
'NoStatus' = (Resolve-ParameterWithDefaultConfigurationValue -Name NoStatus -ConfigValueName DefaultNoStatus)
|
||||
}
|
||||
|
||||
return Invoke-GHRestMethod @params
|
||||
return Invoke-GHRestMethod @params
|
||||
}
|
||||
}
|
||||
|
|
|
@ -370,7 +370,6 @@ function Remove-GitHubProjectCard
|
|||
SupportsShouldProcess,
|
||||
ConfirmImpact = 'High')]
|
||||
[Alias('Delete-GitHubProjectCard')]
|
||||
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess", "", Justification = "Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
|
||||
[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.")]
|
||||
param(
|
||||
[Parameter(Mandatory)]
|
||||
|
|
|
@ -266,7 +266,6 @@ function Remove-GitHubProjectColumn
|
|||
SupportsShouldProcess,
|
||||
ConfirmImpact = 'High')]
|
||||
[Alias('Delete-GitHubProjectColumn')]
|
||||
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess", "", Justification = "Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
|
||||
[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.")]
|
||||
param(
|
||||
[Parameter(Mandatory)]
|
||||
|
|
|
@ -465,6 +465,11 @@ function Remove-GitHubProject
|
|||
|
||||
Remove project with ID '4387531'.
|
||||
|
||||
.EXAMPLE
|
||||
Remove-GitHubProject -Project 4387531 -Confirm:$false
|
||||
|
||||
Remove project with ID '4387531' without prompting for confirmation.
|
||||
|
||||
.EXAMPLE
|
||||
$project = Get-GitHubProject -OwnerName Microsoft -RepositoryName PowerShellForGitHub | Where-Object Name -eq 'TestProject'
|
||||
Remove-GitHubProject -Project $project.id
|
||||
|
@ -476,7 +481,6 @@ function Remove-GitHubProject
|
|||
SupportsShouldProcess,
|
||||
ConfirmImpact = 'High')]
|
||||
[Alias('Delete-GitHubProject')]
|
||||
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess", "", Justification = "Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
|
||||
[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.")]
|
||||
param(
|
||||
[Parameter(Mandatory)]
|
||||
|
|
|
@ -217,12 +217,17 @@ function Remove-GitHubRepository
|
|||
|
||||
.EXAMPLE
|
||||
Remove-GitHubRepository -Uri https://github.com/You/YourRepoToDelete
|
||||
|
||||
.EXAMPLE
|
||||
Remove-GitHubRepository -Uri https://github.com/You/YourRepoToDelete -Confirm:$false
|
||||
|
||||
Remove repository with the given URI, without prompting for confirmation.
|
||||
#>
|
||||
[CmdletBinding(
|
||||
SupportsShouldProcess,
|
||||
DefaultParameterSetName='Elements')]
|
||||
DefaultParameterSetName='Elements',
|
||||
ConfirmImpact="High")]
|
||||
[Alias('Delete-GitHubRepository')]
|
||||
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess", "", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
|
||||
param(
|
||||
[Parameter(ParameterSetName='Elements')]
|
||||
[string] $OwnerName,
|
||||
|
@ -250,18 +255,20 @@ function Remove-GitHubRepository
|
|||
'OwnerName' = (Get-PiiSafeString -PlainText $OwnerName)
|
||||
'RepositoryName' = (Get-PiiSafeString -PlainText $RepositoryName)
|
||||
}
|
||||
if ($PSCmdlet.ShouldProcess($RepositoryName, "Remove repository"))
|
||||
{
|
||||
$params = @{
|
||||
'UriFragment' = "repos/$OwnerName/$RepositoryName"
|
||||
'Method' = 'Delete'
|
||||
'Description' = "Deleting $RepositoryName"
|
||||
'AccessToken' = $AccessToken
|
||||
'TelemetryEventName' = $MyInvocation.MyCommand.Name
|
||||
'TelemetryProperties' = $telemetryProperties
|
||||
'NoStatus' = (Resolve-ParameterWithDefaultConfigurationValue -BoundParameters $PSBoundParameters -Name NoStatus -ConfigValueName DefaultNoStatus)
|
||||
}
|
||||
|
||||
$params = @{
|
||||
'UriFragment' = "repos/$OwnerName/$RepositoryName"
|
||||
'Method' = 'Delete'
|
||||
'Description' = "Deleting $RepositoryName"
|
||||
'AccessToken' = $AccessToken
|
||||
'TelemetryEventName' = $MyInvocation.MyCommand.Name
|
||||
'TelemetryProperties' = $telemetryProperties
|
||||
'NoStatus' = (Resolve-ParameterWithDefaultConfigurationValue -BoundParameters $PSBoundParameters -Name NoStatus -ConfigValueName DefaultNoStatus)
|
||||
return Invoke-GHRestMethod @params
|
||||
}
|
||||
|
||||
return Invoke-GHRestMethod @params
|
||||
}
|
||||
|
||||
function Get-GitHubRepository
|
||||
|
|
|
@ -69,7 +69,7 @@ try
|
|||
}
|
||||
}
|
||||
|
||||
$null = Remove-GitHubRepository -Uri ($repo.svn_url)
|
||||
$null = Remove-GitHubRepository -Uri ($repo.svn_url) -Confirm:$false
|
||||
}
|
||||
|
||||
Describe 'Obtaining repository with biggest number of issues' {
|
||||
|
@ -98,8 +98,8 @@ try
|
|||
}
|
||||
}
|
||||
|
||||
$null = Remove-GitHubRepository -Uri $repo1.svn_url
|
||||
$null = Remove-GitHubRepository -Uri $repo2.svn_url
|
||||
$null = Remove-GitHubRepository -Uri ($repo1.svn_url) -Confirm:$false
|
||||
$null = Remove-GitHubRepository -Uri ($repo2.svn_url) -Confirm:$false
|
||||
}
|
||||
|
||||
|
||||
|
@ -192,7 +192,7 @@ try
|
|||
$collaborators.Count | Should be 1
|
||||
}
|
||||
|
||||
$null = Remove-GitHubRepository -OwnerName $script:ownerName -RepositoryName $repositoryName
|
||||
$null = Remove-GitHubRepository -OwnerName $script:ownerName -RepositoryName $repositoryName -Confirm:$false
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -207,7 +207,7 @@ try
|
|||
$contributors.Count | Should be 1
|
||||
}
|
||||
|
||||
$null = Remove-GitHubRepository -OwnerName $script:ownerName -RepositoryName $repositoryName
|
||||
$null = Remove-GitHubRepository -OwnerName $script:ownerName -RepositoryName $repositoryName -Confirm:$false
|
||||
}
|
||||
|
||||
if ($script:accessTokenConfigured)
|
||||
|
@ -251,7 +251,7 @@ try
|
|||
($current.Count - $original.Count) | Should be 1
|
||||
}
|
||||
|
||||
$null = Remove-GitHubRepository -Uri $repo.svn_url
|
||||
$null = Remove-GitHubRepository -Uri $repo.svn_url -Confirm:$false
|
||||
}
|
||||
|
||||
Describe 'Getting unique contributors from contributors array' {
|
||||
|
@ -269,7 +269,7 @@ try
|
|||
$uniqueContributors.Count | Should be 1
|
||||
}
|
||||
|
||||
$null = Remove-GitHubRepository -OwnerName $script:ownerName -RepositoryName $repositoryName
|
||||
$null = Remove-GitHubRepository -OwnerName $script:ownerName -RepositoryName $repositoryName -Confirm:$false
|
||||
}
|
||||
|
||||
Describe 'Getting repository name from url' {
|
||||
|
@ -306,7 +306,7 @@ try
|
|||
$branches[0].name | Should be 'master'
|
||||
}
|
||||
|
||||
$null = Remove-GitHubRepository -OwnerName $script:ownerName -RepositoryName $repositoryName
|
||||
$null = Remove-GitHubRepository -OwnerName $script:ownerName -RepositoryName $repositoryName -Confirm:$false
|
||||
}
|
||||
}
|
||||
finally
|
||||
|
|
|
@ -52,7 +52,7 @@ try
|
|||
$issue.assignee.login | Should be $assigneeUserName
|
||||
}
|
||||
|
||||
Remove-GithubAssignee -Uri $repo.svn_url -Issue $issue.number -Assignee $assignees
|
||||
Remove-GithubAssignee -Uri $repo.svn_url -Issue $issue.number -Assignee $assignees -Confirm:$false
|
||||
$issue = Get-GitHubIssue -Uri $repo.svn_url -Issue $issue.number
|
||||
|
||||
It 'Should have removed the user from issue' {
|
||||
|
@ -61,7 +61,7 @@ try
|
|||
}
|
||||
}
|
||||
|
||||
Remove-GitHubRepository -Uri $repo.svn_url
|
||||
Remove-GitHubRepository -Uri $repo.svn_url -Confirm:$false
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
|
|
@ -76,7 +76,7 @@ try
|
|||
}
|
||||
|
||||
foreach($comment in $existingComments) {
|
||||
Remove-GitHubComment -Uri $repo.svn_url -CommentID $comment.id
|
||||
Remove-GitHubComment -Uri $repo.svn_url -CommentID $comment.id -Confirm:$false
|
||||
}
|
||||
|
||||
$existingComments = @(Get-GitHubComment -Uri $repo.svn_url)
|
||||
|
@ -86,7 +86,7 @@ try
|
|||
}
|
||||
}
|
||||
|
||||
Remove-GitHubRepository -Uri $repo.svn_url
|
||||
Remove-GitHubRepository -Uri $repo.svn_url -Confirm:$false
|
||||
}
|
||||
}
|
||||
finally
|
||||
|
|
|
@ -162,7 +162,7 @@ try
|
|||
}
|
||||
}
|
||||
|
||||
Remove-GitHubRepository -Uri $repo.svn_url
|
||||
Remove-GitHubRepository -Uri $repo.svn_url -Confirm:$false
|
||||
}
|
||||
}
|
||||
finally
|
||||
|
|
|
@ -37,7 +37,7 @@ try
|
|||
}
|
||||
}
|
||||
|
||||
$null = Remove-GitHubRepository -OwnerName $ownerName -RepositoryName $repositoryName
|
||||
$null = Remove-GitHubRepository -OwnerName $ownerName -RepositoryName $repositoryName -Confirm:$false
|
||||
}
|
||||
|
||||
Describe 'Getting events from an issue' {
|
||||
|
@ -63,7 +63,7 @@ try
|
|||
}
|
||||
}
|
||||
|
||||
$null = Remove-GitHubRepository -OwnerName $ownerName -RepositoryName $repositoryName
|
||||
$null = Remove-GitHubRepository -OwnerName $ownerName -RepositoryName $repositoryName -Confirm:$false
|
||||
}
|
||||
|
||||
Describe 'Getting an event directly' {
|
||||
|
@ -82,7 +82,7 @@ try
|
|||
}
|
||||
}
|
||||
|
||||
$null = Remove-GitHubRepository -OwnerName $ownerName -RepositoryName $repositoryName
|
||||
$null = Remove-GitHubRepository -OwnerName $ownerName -RepositoryName $repositoryName -Confirm:$false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ try
|
|||
}
|
||||
}
|
||||
|
||||
$null = Remove-GitHubRepository -OwnerName $ownerName -RepositoryName $repositoryName
|
||||
$null = Remove-GitHubRepository -OwnerName $ownerName -RepositoryName $repositoryName -Confirm:$false
|
||||
}
|
||||
|
||||
Describe 'Creating new label' {
|
||||
|
@ -110,10 +110,10 @@ try
|
|||
}
|
||||
|
||||
AfterEach {
|
||||
Remove-GitHubLabel -OwnerName $ownerName -RepositoryName $repositoryName -Name $labelName
|
||||
Remove-GitHubLabel -OwnerName $ownerName -RepositoryName $repositoryName -Name $labelName -Confirm:$false
|
||||
}
|
||||
|
||||
$null = Remove-GitHubRepository -OwnerName $ownerName -RepositoryName $repositoryName
|
||||
$null = Remove-GitHubRepository -OwnerName $ownerName -RepositoryName $repositoryName -Confirm:$false
|
||||
}
|
||||
|
||||
Describe 'Removing label' {
|
||||
|
@ -129,14 +129,14 @@ try
|
|||
$labels.Count | Should be ($defaultLabels.Count + 1)
|
||||
}
|
||||
|
||||
Remove-GitHubLabel -OwnerName $ownerName -RepositoryName $repositoryName -Name $labelName
|
||||
Remove-GitHubLabel -OwnerName $ownerName -RepositoryName $repositoryName -Name $labelName -Confirm:$false
|
||||
$labels = @(Get-GitHubLabel -OwnerName $ownerName -RepositoryName $repositoryName)
|
||||
|
||||
It 'Should return expected number of labels' {
|
||||
$labels.Count | Should be $defaultLabels.Count
|
||||
}
|
||||
|
||||
$null = Remove-GitHubRepository -OwnerName $ownerName -RepositoryName $repositoryName
|
||||
$null = Remove-GitHubRepository -OwnerName $ownerName -RepositoryName $repositoryName -Confirm:$false
|
||||
}
|
||||
|
||||
Describe 'Updating label' {
|
||||
|
@ -151,7 +151,7 @@ try
|
|||
$label = Get-GitHubLabel -OwnerName $ownerName -RepositoryName $repositoryName -Name $labelName
|
||||
|
||||
AfterEach {
|
||||
Remove-GitHubLabel -OwnerName $ownerName -RepositoryName $repositoryName -Name $labelName
|
||||
Remove-GitHubLabel -OwnerName $ownerName -RepositoryName $repositoryName -Name $labelName -Confirm:$false
|
||||
}
|
||||
|
||||
It 'Label should have different color' {
|
||||
|
@ -166,7 +166,7 @@ try
|
|||
$label = Get-GitHubLabel -OwnerName $ownerName -RepositoryName $repositoryName -Name $newLabelName
|
||||
|
||||
AfterEach {
|
||||
Remove-GitHubLabel -OwnerName $ownerName -RepositoryName $repositoryName -Name $newLabelName
|
||||
Remove-GitHubLabel -OwnerName $ownerName -RepositoryName $repositoryName -Name $newLabelName -Confirm:$false
|
||||
}
|
||||
|
||||
It 'Label should have different color' {
|
||||
|
@ -175,7 +175,7 @@ try
|
|||
}
|
||||
}
|
||||
|
||||
$null = Remove-GitHubRepository -OwnerName $ownerName -RepositoryName $repositoryName
|
||||
$null = Remove-GitHubRepository -OwnerName $ownerName -RepositoryName $repositoryName -Confirm:$false
|
||||
}
|
||||
|
||||
Describe 'Applying set of labels on repository' {
|
||||
|
@ -193,7 +193,7 @@ try
|
|||
Update-GitHubLabel -OwnerName $ownerName -RepositoryName $repositoryName -Name "bug" -NewName "bug" -Color BBBBBB
|
||||
|
||||
# Remove one of approved labels"
|
||||
Remove-GitHubLabel -OwnerName $ownerName -RepositoryName $repositoryName -Name "discussion"
|
||||
Remove-GitHubLabel -OwnerName $ownerName -RepositoryName $repositoryName -Name "discussion" -Confirm:$false
|
||||
|
||||
It 'Should return increased number of labels' {
|
||||
$($labels).Count | Should be ($defaultLabels.Count + 1)
|
||||
|
@ -208,7 +208,7 @@ try
|
|||
$bugLabel.color | Should be "fc2929"
|
||||
}
|
||||
|
||||
$null = Remove-GitHubRepository -OwnerName $ownerName -RepositoryName $repositoryName
|
||||
$null = Remove-GitHubRepository -OwnerName $ownerName -RepositoryName $repositoryName -Confirm:$false
|
||||
}
|
||||
|
||||
Describe 'Adding labels to an issue'{
|
||||
|
@ -235,7 +235,7 @@ try
|
|||
}
|
||||
}
|
||||
|
||||
$null = Remove-GitHubRepository -OwnerName $ownerName -RepositoryName $repositoryName
|
||||
$null = Remove-GitHubRepository -OwnerName $ownerName -RepositoryName $repositoryName -Confirm:$false
|
||||
}
|
||||
|
||||
Describe 'Creating a new Issue with labels' {
|
||||
|
@ -251,7 +251,7 @@ try
|
|||
$issue.labels.Count | Should be $issueLabels.Count
|
||||
}
|
||||
|
||||
$null = Remove-GitHubRepository -OwnerName $ownerName -RepositoryName $repositoryName
|
||||
$null = Remove-GitHubRepository -OwnerName $ownerName -RepositoryName $repositoryName -Confirm:$false
|
||||
}
|
||||
|
||||
Describe 'Removing labels on an issue'{
|
||||
|
@ -266,9 +266,9 @@ try
|
|||
Add-GitHubIssueLabel -OwnerName $ownerName -RepositoryName $repositoryName -Issue $issue.number -LabelName $labelsToAdd
|
||||
|
||||
Context 'For removing individual issues'{
|
||||
Remove-GitHubIssueLabel -OwnerName $ownerName -RepositoryName $repositoryName -Name "discussion" -Issue $issue.number
|
||||
Remove-GitHubIssueLabel -OwnerName $ownerName -RepositoryName $repositoryName -Name "question" -Issue $issue.number
|
||||
Remove-GitHubIssueLabel -OwnerName $ownerName -RepositoryName $repositoryName -Name "bug" -Issue $issue.number
|
||||
Remove-GitHubIssueLabel -OwnerName $ownerName -RepositoryName $repositoryName -Name "discussion" -Issue $issue.number -Confirm:$false
|
||||
Remove-GitHubIssueLabel -OwnerName $ownerName -RepositoryName $repositoryName -Name "question" -Issue $issue.number -Confirm:$false
|
||||
Remove-GitHubIssueLabel -OwnerName $ownerName -RepositoryName $repositoryName -Name "bug" -Issue $issue.number -Confirm:$false
|
||||
$labelIssues = @(Get-GitHubLabel -OwnerName $ownerName -RepositoryName $repositoryName -Issue $issue.number)
|
||||
|
||||
It 'Should have removed three labels from the issue' {
|
||||
|
@ -277,7 +277,7 @@ try
|
|||
}
|
||||
|
||||
Context 'For removing all issues'{
|
||||
Remove-GitHubIssueLabel -OwnerName $ownerName -RepositoryName $repositoryName -Issue $issue.number
|
||||
Remove-GitHubIssueLabel -OwnerName $ownerName -RepositoryName $repositoryName -Issue $issue.number -Confirm:$false
|
||||
$labelIssues = @(Get-GitHubLabel -OwnerName $ownerName -RepositoryName $repositoryName -Issue $issue.number)
|
||||
|
||||
It 'Should have removed all labels from the issue' {
|
||||
|
@ -285,7 +285,7 @@ try
|
|||
}
|
||||
}
|
||||
|
||||
$null = Remove-GitHubRepository -OwnerName $ownerName -RepositoryName $repositoryName
|
||||
$null = Remove-GitHubRepository -OwnerName $ownerName -RepositoryName $repositoryName -Confirm:$false
|
||||
}
|
||||
|
||||
Describe 'Replacing labels on an issue'{
|
||||
|
@ -319,7 +319,7 @@ try
|
|||
$updatedIssue.labels.Count | Should be $updatedIssueLabels.Count
|
||||
}
|
||||
|
||||
$null = Remove-GitHubRepository -OwnerName $ownerName -RepositoryName $repositoryName
|
||||
$null = Remove-GitHubRepository -OwnerName $ownerName -RepositoryName $repositoryName -Confirm:$false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -110,8 +110,8 @@ try
|
|||
$existingMilestones.Count | Should be 4
|
||||
}
|
||||
|
||||
foreach ($milestone in $existingMilestones) {
|
||||
Remove-GitHubMilestone -Uri $repo.svn_url -Milestone $milestone.number
|
||||
foreach($milestone in $existingMilestones) {
|
||||
Remove-GitHubMilestone -Uri $repo.svn_url -Milestone $milestone.number -Confirm:$false
|
||||
}
|
||||
|
||||
$existingMilestones = @(Get-GitHubMilestone -Uri $repo.svn_url -State All)
|
||||
|
@ -123,7 +123,7 @@ try
|
|||
}
|
||||
}
|
||||
|
||||
Remove-GitHubRepository -Uri $repo.svn_url
|
||||
Remove-GitHubRepository -Uri $repo.svn_url -Confirm:$false
|
||||
}
|
||||
}
|
||||
finally
|
||||
|
|
|
@ -383,7 +383,7 @@ try
|
|||
}
|
||||
}
|
||||
|
||||
Remove-GitHubRepository -Uri $repo.svn_url
|
||||
Remove-GitHubRepository -Uri $repo.svn_url -Confirm:$false
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
|
|
@ -44,8 +44,8 @@ try
|
|||
}
|
||||
|
||||
AfterAll -ScriptBlock {
|
||||
Remove-GitHubRepository -Uri $publicRepo.svn_url
|
||||
Remove-GitHubRepository -Uri $privateRepo.svn_url
|
||||
Remove-GitHubRepository -Uri $publicRepo.svn_url -Confirm:$false
|
||||
Remove-GitHubRepository -Uri $privateRepo.svn_url -Confirm:$false
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@ try
|
|||
}
|
||||
|
||||
AfterAll -ScriptBlock {
|
||||
Remove-GitHubRepository -Uri $repo.svn_url
|
||||
Remove-GitHubRepository -Uri $repo.svn_url -Confirm:$false
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -109,7 +109,7 @@ try
|
|||
}
|
||||
|
||||
AfterAll -ScriptBlock {
|
||||
Remove-GitHubRepository -Uri $repo.svn_url
|
||||
Remove-GitHubRepository -Uri $repo.svn_url -Confirm:$false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ try
|
|||
## cleanup temp testing repository
|
||||
AfterEach -Scriptblock {
|
||||
## variables from BeforeEach scriptblock are accessible here, but not variables from It scriptblocks, so need to make URI (instead of being able to use $renamedRepo variable from It scriptblock)
|
||||
Remove-GitHubRepository -Uri "$($repo.svn_url)$suffixToAddToRepo"
|
||||
Remove-GitHubRepository -Uri "$($repo.svn_url)$suffixToAddToRepo" -Confirm:$false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ try
|
|||
$newForks[0].full_name | Should be "$($script:ownerName)/PowerShellForGitHub"
|
||||
}
|
||||
|
||||
Remove-GitHubRepository -Uri $repo.svn_url
|
||||
Remove-GitHubRepository -Uri $repo.svn_url -Confirm:$false
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ try
|
|||
$newForks[0].full_name | Should be "$($script:organizationName)/PowerShellForGitHub"
|
||||
}
|
||||
|
||||
Remove-GitHubRepository -Uri $repo.svn_url
|
||||
Remove-GitHubRepository -Uri $repo.svn_url -Confirm:$false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ try
|
|||
$referrerList.Count | Should be 0
|
||||
}
|
||||
|
||||
Remove-GitHubRepository -Uri $repo.svn_url
|
||||
Remove-GitHubRepository -Uri $repo.svn_url -Confirm:$false
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ try
|
|||
$pathList.Count | Should be 0
|
||||
}
|
||||
|
||||
Remove-GitHubRepository -Uri $repo.svn_url
|
||||
Remove-GitHubRepository -Uri $repo.svn_url -Confirm:$false
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ try
|
|||
$viewList.Count | Should be 0
|
||||
}
|
||||
|
||||
Remove-GitHubRepository -Uri $repo.svn_url
|
||||
Remove-GitHubRepository -Uri $repo.svn_url -Confirm:$false
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ try
|
|||
$cloneList.Count | Should be 0
|
||||
}
|
||||
|
||||
Remove-GitHubRepository -Uri $repo.svn_url
|
||||
Remove-GitHubRepository -Uri $repo.svn_url -Confirm:$false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче