pcgeek86 / PSGitHub

This PowerShell module contains commands to manage GitHub through its REST API.
MIT License
182 stars 39 forks source link

Problem updating label because required property is missing #56

Closed johlju closed 4 years ago

johlju commented 4 years ago

When updating a label a change at GitHub requires the name to be sent in the request.

Invoke-GitHubApi : Validation Failed
See https://developer.github.com/v3/issues/labels/#update-a-label
PATCH https://api.github.com/repos/DscCommunity/DscResource.Analysis/labels/bug UnprocessableEntity
At C:\Users\johlju\Documents\PowerShell\Modules\PSGitHub\0.15.178\Functions\Public\Update-GitHubLabel.ps1:110 char:9
+         Invoke-GitHubApi @apiCall
+         ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Invoke-GitHubApi

So this:

https://github.com/pcgeek86/PSGitHub/blob/8a74429264b64a5c90e7a397b8f96f7f0734265f/Functions/Public/Update-GitHubLabel.ps1#L85-L87

Need to change to this:

        if ($NewName) {
            $bodyProperties['name'] = $NewName
        } else {
            $bodyProperties['name'] = $Name
        }
felixfbecker commented 4 years ago

Wanna do a PR?

johlju commented 4 years ago

If I have time this weekend I can send in a Pr fixing this.

johlju commented 4 years ago

Fix is in PR https://github.com/pcgeek86/PSGitHub/pull/58