Skip to content

Commit

Permalink
Fix issue preventing labels from being updated when updating Issue
Browse files Browse the repository at this point in the history
Similar to #76, `Update-GitHubIssue` was passing in the provided
labels as `label` instead of `labels` in the request body.
  • Loading branch information
HowardWolosky committed Dec 14, 2018
1 parent c63496c commit 577f07b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion GitHubIssues.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
{
Expand Down
7 changes: 7 additions & 0 deletions Tests/GitHubLabels.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down

0 comments on commit 577f07b

Please sign in to comment.