Skip to content

Commit 577f07b

Browse files
committed
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.
1 parent c63496c commit 577f07b

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

GitHubIssues.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ function Update-GitHubIssue
640640
if ($PSBoundParameters.ContainsKey('Title')) { $hashBody['title'] = $Title }
641641
if ($PSBoundParameters.ContainsKey('Body')) { $hashBody['body'] = $Body }
642642
if ($PSBoundParameters.ContainsKey('Assignee')) { $hashBody['assignees'] = @($Assignee) }
643-
if ($PSBoundParameters.ContainsKey('Label')) { $hashBody['label'] = @($Label) }
643+
if ($PSBoundParameters.ContainsKey('Label')) { $hashBody['labels'] = @($Label) }
644644
if ($PSBoundParameters.ContainsKey('State')) { $hashBody['state'] = $State }
645645
if ($PSBoundParameters.ContainsKey('Milestone'))
646646
{

Tests/GitHubLabels.tests.ps1

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,13 @@ try
378378
$labelIssues.Count | Should be $defaultLabels.Count
379379
}
380380

381+
$updatedIssueLabels = @($labelsToAdd[0])
382+
$updatedIssue = Update-GitHubIssue -OwnerName $ownerName -RepositoryName $repositoryName -Issue $issue.number -Label $updatedIssueLabels
383+
384+
It 'Should have 1 label after updating the issue' {
385+
$updatedIssue.labels.Count | Should be $updatedIssueLabels.Count
386+
}
387+
381388
$null = Remove-GitHubRepository -OwnerName $ownerName -RepositoryName $repositoryName
382389
}
383390
}

0 commit comments

Comments
 (0)