-
Notifications
You must be signed in to change notification settings - Fork 188
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
Adding complete Pipeline support to the entire module #242
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). |
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 -Force So 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
:Name
parameter is nowBranchName
.*-GitHub*Label
:Name
parameter is nowLabel
.*-GitHubLabel
:Milestone
parameter is nowMilestoneNumber
.*-GitHubIssue
:Milestone
parameter is nowMilestoneNumber
.Get-GitHubLicense
:Name
parameter is nowKey
.Get-GitHubCodeOfConduct
:Name
parameter is nowKey
.New-ProjectCard
: Signature has changed. Instead of specifyingContentId
andContentType
, you now just directly specify eitherIssueId
orPullRequestId
.Get-GitHubUserContextualInformation
: Signature has changed. Instead of specifyingSubjectId
andSubjectType
, you now just directly specify eitherOrganizationId
,RepositoryId
,IssueId
orPullRequestId
.Breaks With Workarounds
A number of changes to the Comments functions
GitHubComments.ps1
was renamed toGitHubIssueComments.ps1
given that there are 5 different types of comments, these functions focus onIssue
comments, 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
*-GitHubComment
to*-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
CommentId
toComment
, however it was aliased back toCommentId
.*-GitHubProject
:ArchivedState
parameter is nowState
(but aliased back toArchivedState
to help with migration).*-GitHubProject
:Name
parameter is nowColumnName
(but aliased back toName
)*-GitHubProjectColumn
:Name
parameter is nowColumnName
(but aliased back toName
)Move-GitHubProjectCard
:ColumnId
parameter is nowColumn
(but aliased back toColumnId
to support pipeline input).Get-GitHubRelease
:ReleaseId
parameter is nowRelease
(but aliased back toReleaseId
to support pipeline input).Rename-GitHubRepository
has been effectively deprectaed. It was built on top of the same endpoint thatSet-GitHubRepository
uses, but was only modifying a single property (the name). For now, the function remains, but it now just internally calls intoSet-GitHubRepository
to perform the same action.Set-GitHubRepositoryTopic
:Name
parameter is nowTopic
(but aliased back toName
).Get-GitHubUser
:User
parameter is nowUserName
(but aliased back toUser
andName
).Get-GitHubUserContextualInformation
:User
parameter is nowUserName
(but aliased back toUser
andName
).Bug Fixes:
sailor-v
AcceptHeader. This was fixed as part of the migration to using the AcceptHeader constants.Lock-GitHubIssue
was not correctly providing thelock_reason
value to the API, so that metadata was getting lost. This was caught by new UT's and then fixed.Update-GitHubLabel
was modified to accept colors both with and without a leading # sign, just likeNew-GitHubLabel
already supported.New Features:
Get-GitHubGitIgnore
has a newRawContent
switch which allows you to directly get back the content of the actual .gitignore file.Set-GitHubRepository
has 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:$false
and/or-Force
to avoid the confirmation.Get-GitHubRepositoryCollaborator
has gained a new parameterAffiliation
allowing you to filter which collaborators you're interested in querying for.Minor updates:
GitHub
in theAssignee
method names (wasGithub
intead ofGitHub
DisablePipelineSupport
) to assist with pipeline developmentAcceptHeader
usage has migrated to using script-wide constantsSplit-GitHubUri
can now return both components in a single function call if no switch is specified.Join-GitHubUri
which can reverse whatSplit-GitHubUri
does, based on the configuredApiHostName
..OUTPUTS
and[OutputType()]
for every function.Test changes:
Set-StrictMode -Version 1.0
has been specified for all tests to catch access to undeclared variables (which should help catch common typo errors)PSUseDeclaredVarsMoreThanAssignments
have 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