-
Notifications
You must be signed in to change notification settings - Fork 190
Adding complete Pipeline support to the entire module #242
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ormation to be more natural
(and to work better with pipelining)
* Added new pipeline-related tests to GitHubAssinees.tests.ps1
* Created GitHubUsers.tests.ps1 and added a number of new tests for Users.
* Moved a number of unrelated tests out of GitHubAnalytics.tests.ps1 to existing or new files:
* Some tests moved to GitHubRepositories.tests.ps1
* Moved `Split-GitHubUri` tests to GitHubCore.tests.ps1
* Also added some new ones
* Some tests moved to a new GitHubBranches.tests.ps1
* Some tests moved to a new GitHubIssues.tests.ps1
* Fixed handling of typing for Repo Contributors, Collaborators and Tags. * Added missing 'Affiliation' parameter to Get-GitHubRepositoryCollaborator * Completed required repository tests
This also fixes a bug with the `sailor-v` accept header which had been spelled wrong.
|
@X-Guardian / @rjmholt / @TylerLeonhardt / @themilanfan - I'd be interested in your input. The change here is pretty robust and well-tested, but it would be great to get some other eyes on this for how it feels. If you have a chance, try checking out the branch and running through some scenarios to see if it's working the way that you'd expect. I'd love any feedback. I really want to get this change merged in before taking in much of the outstanding PR's that are adding new functionality. |
|
/azp run PowerShellForGitHub-CI |
|
Azure Pipelines successfully started running 1 pipeline(s). |
X-Guardian
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work @HowardWolosky , looks good. I've tested passing GitHub.Repo objects between functions, and everything I tried worked fine.
I've reviewed all the module files, but not looked at the test files and beyond yet.
|
Also, how about adding the supported pipeline input object types to |
Thanks -- and to be clear (if it wasn't already), this isn't limited to repo objects. You could even pipe a milestone object into A simple repo one that I've enjoyed lately on my test account when I was doing a lot of verification against the work was: Get-GitHubRepository | Remove-GitHubRepository -ForceSo clean and clear. Thanks for the review/feedback as well, @X-Guardian ... much appreciated. |
That's reasonable feedback. It was an oversight because I wasn't familiar enough with what it was supposed to specifically address, but I just looked it up. I'll get the specific |
|
/azp run PowerShellForGitHub-CI |
|
Azure Pipelines successfully started running 1 pipeline(s). |
* Fixes a regression that was introduced in microsoft#242. A `Write-Log` command was accidentally updated to pass in `=Message` instead of `-Message`. * Updates the web request to suppress the progress bar using $ProgressPreference = 'SilentlyContinue' Fixes microsoft#249 Fixes microsoft#250
* Fixes a regression [introduced by #242 unfortunately](17f6122#diff-34a614678760cc83c5a91ad95ae240e5R86) when I was reducing the lines in the module that exceeded 100 chars. Specifically (note the `=Message` instead of the `-Message`): https://github.com/microsoft/PowerShellForGitHub/blob/17f6122d7812ee4001ce4bdf630429e711e45f7b/UpdateCheck.ps1#L86 * Updates the web request to suppress the progress bar using `$ProgressPreference = 'SilentlyContinue'` * Adds a `-Force` switch to force the update check to happen again to make future debugging scenarios easier. Fixes #249 Fixes #250
Description
Comprehensively adds pipeline support throughout the entire module
This change required examining every method, and in some cases a few breaking changes (noted below) had to be introduced in order to make support work consistently end-to-end. UT's were added for every function, which resuled in a few bugs that were identified and fixed (also noted below).
Breaking changes
Unavoidable Breaks
Get-GitHubRepositoryBranch:Nameparameter is nowBranchName.*-GitHub*Label:Nameparameter is nowLabel.*-GitHubLabel:Milestoneparameter is nowMilestoneNumber.*-GitHubIssue:Milestoneparameter is nowMilestoneNumber.Get-GitHubLicense:Nameparameter is nowKey.Get-GitHubCodeOfConduct:Nameparameter is nowKey.New-ProjectCard: Signature has changed. Instead of specifyingContentIdandContentType, you now just directly specify eitherIssueIdorPullRequestId.Get-GitHubUserContextualInformation: Signature has changed. Instead of specifyingSubjectIdandSubjectType, you now just directly specify eitherOrganizationId,RepositoryId,IssueIdorPullRequestId.Breaks With Workarounds
A number of changes to the Comments functions
GitHubComments.ps1was renamed toGitHubIssueComments.ps1given that there are 5 different types of comments, these functions focus onIssuecomments, and there doesn't currently appear to be a path forward for creating a single unified API set for all comment types.All of these methods were renamed from
*-GitHubCommentto*-GitHubIssueComment, however they were also aliased back to their previous names (for now). You should really migrate to these new names however.The main parameter was renamed from
CommentIdtoComment, however it was aliased back toCommentId.*-GitHubProject:ArchivedStateparameter is nowState(but aliased back toArchivedStateto help with migration).*-GitHubProject:Nameparameter is nowColumnName(but aliased back toName)*-GitHubProjectColumn:Nameparameter is nowColumnName(but aliased back toName)Move-GitHubProjectCard:ColumnIdparameter is nowColumn(but aliased back toColumnIdto support pipeline input).Get-GitHubRelease:ReleaseIdparameter is nowRelease(but aliased back toReleaseIdto support pipeline input).Rename-GitHubRepositoryhas been effectively deprectaed. It was built on top of the same endpoint thatSet-GitHubRepositoryuses, but was only modifying a single property (the name). For now, the function remains, but it now just internally calls intoSet-GitHubRepositoryto perform the same action.Set-GitHubRepositoryTopic:Nameparameter is nowTopic(but aliased back toName).Get-GitHubUser:Userparameter is nowUserName(but aliased back toUserandName).Get-GitHubUserContextualInformation:Userparameter is nowUserName(but aliased back toUserandName).Bug Fixes:
sailor-vAcceptHeader. This was fixed as part of the migration to using the AcceptHeader constants.Lock-GitHubIssuewas not correctly providing thelock_reasonvalue to the API, so that metadata was getting lost. This was caught by new UT's and then fixed.Update-GitHubLabelwas modified to accept colors both with and without a leading # sign, just likeNew-GitHubLabelalready supported.New Features:
Get-GitHubGitIgnorehas a newRawContentswitch which allows you to directly get back the content of the actual .gitignore file.Set-GitHubRepositoryhas been updated to allow users to change the name (rename) the repository at the same time as making any of their other changes. If a new name has been specified, users will be required to confirm the change, or to specify-Confirm:$falseand/or-Forceto avoid the confirmation.Get-GitHubRepositoryCollaboratorhas gained a new parameterAffiliationallowing you to filter which collaborators you're interested in querying for.Minor updates:
GitHubin theAssigneemethod names (wasGithubintead ofGitHubDisablePipelineSupport) to assist with pipeline developmentAcceptHeaderusage has migrated to using script-wide constantsSplit-GitHubUrican now return both components in a single function call if no switch is specified.Join-GitHubUriwhich can reverse whatSplit-GitHubUridoes, based on the configuredApiHostName..OUTPUTSand[OutputType()]for every function.Test changes:
Set-StrictMode -Version 1.0has been specified for all tests to catch access to undeclared variables (which should help catch common typo errors)PSUseDeclaredVarsMoreThanAssignmentshave been removed, and all test files now suppress that rule.Issues Fixed
References
The whole API set
Checklist
If desired, ensure your name is added to our Contributors list