From 577f07bd219e9b5c03d481e562fd7f2fc3586474 Mon Sep 17 00:00:00 2001 From: Howard Wolosky Date: Thu, 13 Dec 2018 21:57:42 -0800 Subject: [PATCH] Fix issue preventing labels from being updated when updating Issue Similar to #76, `Update-GitHubIssue` was passing in the provided labels as `label` instead of `labels` in the request body. --- GitHubIssues.ps1 | 2 +- Tests/GitHubLabels.tests.ps1 | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/GitHubIssues.ps1 b/GitHubIssues.ps1 index da1312c6..a26f50cc 100644 --- a/GitHubIssues.ps1 +++ b/GitHubIssues.ps1 @@ -640,7 +640,7 @@ function Update-GitHubIssue if ($PSBoundParameters.ContainsKey('Title')) { $hashBody['title'] = $Title } if ($PSBoundParameters.ContainsKey('Body')) { $hashBody['body'] = $Body } if ($PSBoundParameters.ContainsKey('Assignee')) { $hashBody['assignees'] = @($Assignee) } - if ($PSBoundParameters.ContainsKey('Label')) { $hashBody['label'] = @($Label) } + if ($PSBoundParameters.ContainsKey('Label')) { $hashBody['labels'] = @($Label) } if ($PSBoundParameters.ContainsKey('State')) { $hashBody['state'] = $State } if ($PSBoundParameters.ContainsKey('Milestone')) { diff --git a/Tests/GitHubLabels.tests.ps1 b/Tests/GitHubLabels.tests.ps1 index d081b71d..65f8eba5 100644 --- a/Tests/GitHubLabels.tests.ps1 +++ b/Tests/GitHubLabels.tests.ps1 @@ -378,6 +378,13 @@ try $labelIssues.Count | Should be $defaultLabels.Count } + $updatedIssueLabels = @($labelsToAdd[0]) + $updatedIssue = Update-GitHubIssue -OwnerName $ownerName -RepositoryName $repositoryName -Issue $issue.number -Label $updatedIssueLabels + + It 'Should have 1 label after updating the issue' { + $updatedIssue.labels.Count | Should be $updatedIssueLabels.Count + } + $null = Remove-GitHubRepository -OwnerName $ownerName -RepositoryName $repositoryName } }