Skip to content

Commit

Permalink
Improvements to GitHub Team API's (#275)
Browse files Browse the repository at this point in the history
#257 did a fantastic job closing the gap on missing functionality in the module related to GitHub Teams.
This PR just adds onto that work by providing options that will reduce the need for additional queries during common operations.

* `Get-GitHubTeam`: **Breaking Change** Looking up a team by its `ID` has been deprecated per GitHub documentation.  Removed that functionality and added the ability to look up by `slug` instead.  This also means that you can now pipe in a team and get back the specific result without needing to filter through all org results.

* `Get-GitHubTeamMember`: Updated to use the `slug` instead of the team `ID`.

* `New-GitHubTeam`: Added ability to pass in the `ParentTeamId` (also via the pipeline) to avoid the need to query through all org teams.

* `Set-GitHubTeam`: Added ability to pass in the team `slug` (also via the pipeline) to avoid the need to query through all org teams.  Similar to `New-GitHubTeam`, also added the ability to pass-in the `ParentTeamId` to avoid the full org team lookup.

* `Remove-GitHubTeam`: Added ability to pass in the team `slug` (also via the pipeline) to avoid the need to query through all org teams.

* Added `Rename-GitHubTeam` as a helper/wrapper on top of `Set-GitHubTeam`

* Added additional pipeline tests for existing functions

* Added new tests for `Rename-GitHubTeam` and `Get-GitHubTeamMember`

* Small update to formatters to simplify the display of the team parent

References: [GitHub Teams API](https://developer.github.com/v3/teams/)
  • Loading branch information
HowardWolosky authored Aug 14, 2020
1 parent 9600fc2 commit 9ef3c2b
Show file tree
Hide file tree
Showing 4 changed files with 632 additions and 110 deletions.
22 changes: 20 additions & 2 deletions Formatters/GitHubTeams.Format.ps1xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,23 @@
<TypeName>GitHub.TeamSummary</TypeName>
</ViewSelectedBy>
<TableControl>
<TableHeaders>
<TableColumnHeader>
<Label>name</Label>
</TableColumnHeader>
<TableColumnHeader>
<Label>description</Label>
</TableColumnHeader>
<TableColumnHeader>
<Label>privacy</Label>
</TableColumnHeader>
<TableColumnHeader>
<Label>permission</Label>
</TableColumnHeader>
<TableColumnHeader>
<Label>OrganizationName</Label>
</TableColumnHeader>
</TableHeaders>
<TableRowEntries>
<TableRowEntry>
<TableColumnItems>
Expand Down Expand Up @@ -57,7 +74,7 @@
<PropertyName>created_at</PropertyName>
</ListItem>
<ListItem>
<PropertyName>updated_at</PropertyName>
<PropertyName>created_at</PropertyName>
</ListItem>
<ListItem>
<PropertyName>members_count</PropertyName>
Expand All @@ -66,7 +83,8 @@
<PropertyName>repos_count</PropertyName>
</ListItem>
<ListItem>
<PropertyName>parent</PropertyName>
<Label>parent.name</Label>
<ScriptBlock>$_.parent.name</ScriptBlock>
</ListItem>
<ListItem>
<PropertyName>OrganizationName</PropertyName>
Expand Down
Loading

0 comments on commit 9ef3c2b

Please sign in to comment.