Skip to content

GitHubRepositories: Add Output Type Views - #205

Merged
Howard Wolosky (HowardWolosky) merged 11 commits into
microsoft:masterfrom
X-Guardian:GitHubRepositories-TypeViews
Jun 27, 2020
Merged

GitHubRepositories: Add Output Type Views#205
Howard Wolosky (HowardWolosky) merged 11 commits into
microsoft:masterfrom
X-Guardian:GitHubRepositories-TypeViews

Conversation

@X-Guardian

@X-GuardianSimon Heather (X-Guardian) commented May 31, 2020

Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Contributor

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.

Comment threadGitHubRepositories.ps1 Outdated
Comment threadGitHubRepositories.ps1 Outdated
Comment threadPowerShellForGitHub.Format.ps1xml Outdated
Comment threadGitHubRepositories.ps1 Outdated
@HowardWoloskyHoward Wolosky (HowardWolosky) added the enhancement An issue or pull request introducing new functionality to the project. label Jun 1, 2020
@HowardWolosky

Copy link
Copy Markdown
Contributor

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
Copy Markdown
ContributorAuthor

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
Copy Markdown
Contributor

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

@HowardWolosky

Copy link
Copy Markdown
Contributor

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
Copy Markdown
ContributorAuthor

No problem Howard Wolosky (@HowardWolosky).

Copy link
Copy Markdown
Contributor

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.

@HowardWoloskyHoward Wolosky (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
Copy Markdown
ContributorAuthor

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

@X-Guardian

Copy link
Copy Markdown
ContributorAuthor

Howard Wolosky (@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
Copy Markdown
Contributor

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
Copy Markdown
ContributorAuthor

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
Simon Heather (X-Guardian) marked this pull request as ready for review June 27, 2020 16:29
@X-GuardianSimon Heather (X-Guardian) changed the title GitHubRepositories: Add Output Types and ViewsGitHubRepositories: Add Output ViewsJun 27, 2020
@X-GuardianSimon Heather (X-Guardian) changed the title GitHubRepositories: Add Output ViewsGitHubRepositories: Add Output Type ViewsJun 27, 2020
@X-Guardian

Copy link
Copy Markdown
ContributorAuthor

Howard Wolosky (@HowardWolosky), can we trigger the CI for this PR?

Copy link
Copy Markdown
Contributor

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.

Comment threadGitHubRepositories.ps1 Outdated
@HowardWolosky

Copy link
Copy Markdown
Contributor

/azp run PowerShellForGitHub-CI

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancementAn issue or pull request introducing new functionality to the project.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@X-Guardian@HowardWolosky