Repository navigation
Fix labels in events being treated as full label objects - #306
Howard Wolosky (HowardWolosky) merged 6 commits into
Conversation
Howard Wolosky (HowardWolosky)
left a comment
There was a problem hiding this comment.
Thanks for the report. I was able to repro your issue by calling
Get-GitHubEvent -OwnerName microsoft -RepositoryName PowerShellForGitHub -Issue 306What you supplied would indeed fix the specific issue you're running into, but I don't know if it's actually the right fix.
I think the more complete fix would be to create a new Type called GitHub.LabelSummary for the reduce content, similar to what we do for GitHub.Team/GitHub.TeamSummary, and then update Add-GitHubLabelAdditionalProperties to optionally take in the OwnerName and RepositoryName. If supplied, and $item.url is not defined, then those should be used for forming the $repositoryUrl. Then you'd update Add-GitHubEventAdditionalProperties to pass in the ReposistoryUrl and OwnerName along with the new TypeName.
That should fix the bug while also ensuring individual labels can still be passed via the pipeline into other functions.
I'm not as worried about that. The purpose of |
I updated the code, there is no need to update the params to GitHubEventAdditionalProperties as the repository url is already available from the base event object. |
Howard Wolosky (HowardWolosky)
left a comment
There was a problem hiding this comment.
Thanks for the update. Some minor additional updates being requested here.
Howard Wolosky (HowardWolosky)
left a comment
There was a problem hiding this comment.
Thanks for the update.
There are some additional changes to make, but I've already supplied the fixes as suggestions and can apply them myself once this review is submitted.
|
/azp run PowerShellForGitHub-CI |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Description
The Get-GitHubEvent is currently broken if the issue contains and event that includes the "label" or "labels" property. This is because Add-GitHubEventAdditionalProperties treats the labels in the event object as full fledged label objects that normally contain a URL property and other additional pieces of data. The label property in events is a lighter-weight object that simply contains the string for the label and color that was changed, it is not the full object that you would typically receive from a call like Get-GithubLabel.
Issues Fixed
none
References
The docs do not explicitly call this out, but you can check the payload in fiddler for verificaiton.
Checklist