diff --git a/GitHubAssignees.ps1 b/GitHubAssignees.ps1 index f88ce789..e9311c71 100644 --- a/GitHubAssignees.ps1 +++ b/GitHubAssignees.ps1 @@ -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 } diff --git a/GitHubComments.ps1 b/GitHubComments.ps1 index 82aef916..ea66366d 100644 --- a/GitHubComments.ps1 +++ b/GitHubComments.ps1 @@ -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 + } } diff --git a/GitHubLabels.ps1 b/GitHubLabels.ps1 index 172361e7..04eb3ed3 100644 --- a/GitHubLabels.ps1 +++ b/GitHubLabels.ps1 @@ -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 diff --git a/GitHubMilestones.ps1 b/GitHubMilestones.ps1 index c67ecef7..11bf627b 100644 --- a/GitHubMilestones.ps1 +++ b/GitHubMilestones.ps1 @@ -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 + } } diff --git a/GitHubProjectCards.ps1 b/GitHubProjectCards.ps1 index 86ea7988..5eeb0bff 100644 --- a/GitHubProjectCards.ps1 +++ b/GitHubProjectCards.ps1 @@ -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)] diff --git a/GitHubProjectColumns.ps1 b/GitHubProjectColumns.ps1 index c1e84173..aa1b61a8 100644 --- a/GitHubProjectColumns.ps1 +++ b/GitHubProjectColumns.ps1 @@ -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)] diff --git a/GitHubProjects.ps1 b/GitHubProjects.ps1 index df4ecc50..95060198 100644 --- a/GitHubProjects.ps1 +++ b/GitHubProjects.ps1 @@ -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)] diff --git a/GitHubRepositories.ps1 b/GitHubRepositories.ps1 index bff7c159..29228af7 100644 --- a/GitHubRepositories.ps1 +++ b/GitHubRepositories.ps1 @@ -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 diff --git a/Tests/GitHubAnalytics.tests.ps1 b/Tests/GitHubAnalytics.tests.ps1 index 8c5c51c2..44015009 100644 --- a/Tests/GitHubAnalytics.tests.ps1 +++ b/Tests/GitHubAnalytics.tests.ps1 @@ -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 diff --git a/Tests/GitHubAssignees.tests.ps1 b/Tests/GitHubAssignees.tests.ps1 index fc1a89de..5e4738d5 100644 --- a/Tests/GitHubAssignees.tests.ps1 +++ b/Tests/GitHubAssignees.tests.ps1 @@ -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 { diff --git a/Tests/GitHubComments.tests.ps1 b/Tests/GitHubComments.tests.ps1 index 9bdd5a62..66c9242b 100644 --- a/Tests/GitHubComments.tests.ps1 +++ b/Tests/GitHubComments.tests.ps1 @@ -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 diff --git a/Tests/GitHubContents.tests.ps1 b/Tests/GitHubContents.tests.ps1 index 474d4f1d..f0b15b29 100644 --- a/Tests/GitHubContents.tests.ps1 +++ b/Tests/GitHubContents.tests.ps1 @@ -162,7 +162,7 @@ try } } - Remove-GitHubRepository -Uri $repo.svn_url + Remove-GitHubRepository -Uri $repo.svn_url -Confirm:$false } } finally diff --git a/Tests/GitHubEvents.tests.ps1 b/Tests/GitHubEvents.tests.ps1 index 4364dcf0..4411d640 100644 --- a/Tests/GitHubEvents.tests.ps1 +++ b/Tests/GitHubEvents.tests.ps1 @@ -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 } } } diff --git a/Tests/GitHubLabels.tests.ps1 b/Tests/GitHubLabels.tests.ps1 index e040579b..88d7dfd9 100644 --- a/Tests/GitHubLabels.tests.ps1 +++ b/Tests/GitHubLabels.tests.ps1 @@ -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 } } } diff --git a/Tests/GitHubMilestones.tests.ps1 b/Tests/GitHubMilestones.tests.ps1 index 5255afd4..db9ab8cf 100644 --- a/Tests/GitHubMilestones.tests.ps1 +++ b/Tests/GitHubMilestones.tests.ps1 @@ -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 diff --git a/Tests/GitHubProjects.tests.ps1 b/Tests/GitHubProjects.tests.ps1 index 931aa9c7..d523b103 100644 --- a/Tests/GitHubProjects.tests.ps1 +++ b/Tests/GitHubProjects.tests.ps1 @@ -383,7 +383,7 @@ try } } - Remove-GitHubRepository -Uri $repo.svn_url + Remove-GitHubRepository -Uri $repo.svn_url -Confirm:$false } finally { diff --git a/Tests/GitHubRepositories.tests.ps1 b/Tests/GitHubRepositories.tests.ps1 index 2a7361be..e2f4d99d 100644 --- a/Tests/GitHubRepositories.tests.ps1 +++ b/Tests/GitHubRepositories.tests.ps1 @@ -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 } } } diff --git a/Tests/GitHubRepositoryForks.tests.ps1 b/Tests/GitHubRepositoryForks.tests.ps1 index be56f282..16e15669 100644 --- a/Tests/GitHubRepositoryForks.tests.ps1 +++ b/Tests/GitHubRepositoryForks.tests.ps1 @@ -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 } } } diff --git a/Tests/GitHubRepositoryTraffic.tests.ps1 b/Tests/GitHubRepositoryTraffic.tests.ps1 index 53adb0d5..ea542e19 100644 --- a/Tests/GitHubRepositoryTraffic.tests.ps1 +++ b/Tests/GitHubRepositoryTraffic.tests.ps1 @@ -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 } } }