Skip to content
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

GitHubRepositories: Add Output Type Views #205

Merged
merged 11 commits into from
Jun 27, 2020
Merged

GitHubRepositories: Add Output Type Views #205

merged 11 commits into from
Jun 27, 2020

Conversation

X-Guardian
Copy link
Contributor

@X-Guardian X-Guardian commented May 31, 2020

Pull Request description

This PR adds output type views for the following resources in the GitHubRepositories module:

  • GitHub.Repository
  • GitHub.RepositoryTopic
  • GitHub.RepositoryContributor
  • GitHub.RepositoryContributorStatistics
  • GitHub.RepositoryCollaborator
  • GitHub.RepositoryTag

Example Views

GitHub.Repository
Get-GitHubRepository -OwnerName 'octocat' | Select-Object -First 5

full_name                  visibility description
---------                  ---------- -----------
octocat/boysenberry-repo-1 public     Testing
octocat/git-consortium     public     This repo is for demonstration purposes only.
octocat/hello-worId        public     My first repository on GitHub.
octocat/Hello-World        public     My first repository on GitHub!
octocat/linguist           public     Language Savant. If your repository's language is being reported incorrectly, send us a pull request!
GitHub.RepositoryTopic
Get-GitHubRepositorytopic -OwnerName 'microsoft' -RepositoryName PowerToys

names : {powertoys, desktop, windows}
RepositoryUrl: https://github.com/microsoft/PowerToys
GitHub.RepositoryContributor
Get-GitHubRepositorycontributor -OwnerName 'Microsoft' -RepositoryName PowerShellForGithub | Select-Object -First 5

UserName       type contributions
--------       ---- -------------
KarolKaczmarek User 122
HowardWolosky  User 77
joseartrivera  User 7
jpomfret       User 5
jrolstad       User 3
GitHub.RepositoryContributorStatistics
Get-GitHubRepositorycontributor -OwnerName 'Microsoft' -RepositoryName PowerShellForGithub -IncludeStatistics | Select-Object -First 5

author.UserName total weeks
--------------- ----- -----
wikijm          1     {@{w=1457827200; a=0; d=0; c=0}, @{w=1458432000; a=0; d=0; c=0}, @{w=1459036800; a=0; d=0; c=0}, @{w=1459641600; a=0; d=0; c=0}…}
v2kiran         1     {@{w=1457827200; a=0; d=0; c=0}, @{w=1458432000; a=0; d=0; c=0}, @{w=1459036800; a=0; d=0; c=0}, @{w=1459641600; a=0; d=0; c=0}…}
rjmholt         1     {@{w=1457827200; a=0; d=0; c=0}, @{w=1458432000; a=0; d=0; c=0}, @{w=1459036800; a=0; d=0; c=0}, @{w=1459641600; a=0; d=0; c=0}…}
mtboren         1     {@{w=1457827200; a=0; d=0; c=0}, @{w=1458432000; a=0; d=0; c=0}, @{w=1459036800; a=0; d=0; c=0}, @{w=1459641600; a=0; d=0; c=0}…}
kant            1     {@{w=1457827200; a=0; d=0; c=0}, @{w=1458432000; a=0; d=0; c=0}, @{w=1459036800; a=0; d=0; c=0}, @{w=1459641600; a=0; d=0; c=0}…}
GitHub.RepositoryCollaborator
Get-GitHubRepositoryCollaborator -OwnerName 'dsccommunity' -RepositoryName ActiveDirectoryDsc | Select-Object -First 5

UserName        permissions.admin permissions.push permissions.pull
--------        ----------------- ---------------- ----------------
tysonjhayes     False             False            True
NikCharlebois   False             False            True
concentrateddon False             False            True
mgreenegit      True              True             True
johlju          True              True             True
GitHub.RepositoryTag
Get-GitHubRepositoryTag -OwnerName 'microsoft' -RepositoryName PowerShellForGithub | Select-Object -First 5

name   commit.sha
----   ----------
0.14.0 ed9b114fe25dfb2d91752cbf06d0b5c0389b30ca
0.13.1 d279f1c7e1bd8261cdcf9dab6a8b78d3a0004457
0.13.0 79c30d4d3ce2b56281ab6c040173973c416b2ef2
0.12.0 d68503ffc0c3e16f515871570e80aecf2ac9693e
0.11.0 78cd480e1ee9f5baa9ce1d58462210bf8bfe9087

@X-Guardian X-Guardian mentioned this pull request May 31, 2020
Copy link
Member

@HowardWolosky HowardWolosky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is pretty awesome. Thanks so much for tackling this!
I've left some minor feedback for you to consider.

Aside
WinDbg has this really neat feature where some of the command output is hyperlinked, and clicking it results in WinDbg executing another debug command that was embedded in the hyperlink. Does the PowerShell formatter have any type of support for something like that? I quick search seems to say no, but I thought I'd ask you as well. I could just imagine having the values in the 'login' column being clickable, which would cause it to execute Get-GitHubUser -Name $_.login to get additional information on that user.

GitHubRepositories.ps1 Outdated Show resolved Hide resolved
GitHubRepositories.ps1 Outdated Show resolved Hide resolved
PowerShellForGitHub.Format.ps1xml Outdated Show resolved Hide resolved
GitHubRepositories.ps1 Outdated Show resolved Hide resolved
@HowardWolosky HowardWolosky added the enhancement An issue or pull request introducing new functionality to the project. label Jun 1, 2020
@HowardWolosky
Copy link
Member

One other thought I had...we might want to have a sub-directory for Formatters to try to keep the directory a bit more manageable. Can you do that, and update the reference in the manifest? I believe that it allows for sub-directory references...

@X-Guardian
Copy link
Contributor Author

I've moved the ps1xml format file into a Formatters directory, and renamed it, so that there can be one format file for each nested module.

@HowardWolosky
Copy link
Member

Thanks -- will give a final pass at this tomorrow, and then hopefully get it merged in.

@HowardWolosky
Copy link
Member

I'm holding off on this one for another couple days as I'm examining a consistent approach to pipelining and type definitions across the entire module. We'll definitely be taking this formatter change soon. It's just that the work you're doing to add the type information in this PR may be superseded by that larger effort (which is definitely influenced by what you're doing here).

If interested, you can take a look at my early thoughts on that larger approach: HowardWolosky/PowerShellForGitHub@e6b5ef6

@X-Guardian
Copy link
Contributor Author

No problem @HowardWolosky.

Copy link
Member

@HowardWolosky HowardWolosky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one should be easy to update after the pipeline change.. just dropping the changes to GitHubRepositories.ps1. It's not clear to me though why the .wiki submodule is part of this change though.

@HowardWolosky HowardWolosky added the waiting for update Waiting for an update to the PR before the next review label Jun 20, 2020
@X-Guardian
Copy link
Contributor Author

I'll finish this PR once all the other GitHubRepositories PRs have been merged: #221, #233 and #235.

@X-Guardian
Copy link
Contributor Author

@HowardWolosky, just looking at finishing this PR. The current output types of Get-GitHubRepositoryCollaborator and Get-GitHubRepositoryContributor have been set as GitHub.User, but they return a different schema than Get-GitHubUser, so they need to have their own types.

Are you OK with GitHub.RepositoryCollaborator and GitHub.RepositoryContributor?

@HowardWolosky
Copy link
Member

Nice catch. That was an oversight on my part. I didn't look carefully enough.

Are you OK with GitHub.RepositoryCollaborator and GitHub.RepositoryContributor?

I'm feeling a bit torn. Those make complete sense to me on the one hand. On the other, Repository feels a little redundant because that's the only thing someone could be a contributor or collaborator on. That then puts into question whether Get-GitHubRepository[Contributor|Collaborator] should really be Get-GitHub[Contributor|Collaborator].

I'd say move forward with your suggestion. If it feels unnatural after we start using it, we can look at changing it.

Thanks again. I really appreciate all of your contributions to this project.

@X-Guardian
Copy link
Contributor Author

OK, code updated. I've changed the login property to the UserName property on the GitHub.RepositoryContributor and GitHub.RepositoryCollaborator type views and added the RepositoryUrl to the GitHub.RepositoryTopic type view.

@X-Guardian X-Guardian marked this pull request as ready for review June 27, 2020 16:29
@X-Guardian X-Guardian changed the title GitHubRepositories: Add Output Types and Views GitHubRepositories: Add Output Views Jun 27, 2020
@X-Guardian X-Guardian changed the title GitHubRepositories: Add Output Views GitHubRepositories: Add Output Type Views Jun 27, 2020
@X-Guardian
Copy link
Contributor Author

@HowardWolosky, can we trigger the CI for this PR?

Copy link
Member

@HowardWolosky HowardWolosky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great. Thanks for catching the mistake with the output types of contributor/collaborator.

Minor formatting change request for variable names, and then we can get this merged in.
You may have a merge conflict to address in #233 once this goes in.

GitHubRepositories.ps1 Outdated Show resolved Hide resolved
@HowardWolosky
Copy link
Member

/azp run PowerShellForGitHub-CI

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@HowardWolosky HowardWolosky merged commit 41de3ad into microsoft:master Jun 27, 2020
@HowardWolosky HowardWolosky removed the waiting for update Waiting for an update to the PR before the next review label Jun 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An issue or pull request introducing new functionality to the project.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants