diff --git a/src/classes/public/App/GitHubAppInstallation.ps1 b/src/classes/public/App/GitHubAppInstallation.ps1 index c0071d3ad..5335e4830 100644 --- a/src/classes/public/App/GitHubAppInstallation.ps1 +++ b/src/classes/public/App/GitHubAppInstallation.ps1 @@ -38,6 +38,9 @@ # The account that suspended the installation. [GitHubUser] $SuspendedBy + # The URL to the target's profile based on the target type. + [string] $Url + GitHubAppInstallation() {} GitHubAppInstallation([PSCustomObject] $Object) { @@ -59,9 +62,10 @@ $this.UpdatedAt = $Object.updated_at $this.SuspendedAt = $Object.suspended_at $this.SuspendedBy = [GitHubUser]::new($Object.suspended_by) + $this.Url = $Object.html_url } - GitHubAppInstallation([PSCustomObject] $Object, [string] $Target, [string] $Type) { + GitHubAppInstallation([PSCustomObject] $Object, [string] $Target, [string] $Type, [string] $HostName) { $this.ID = $Object.id $this.App = [GitHubApp]::new( [PSCustomObject]@{ @@ -70,7 +74,11 @@ app_slug = $Object.app_slug } ) - $this.Target = [GitHubOwner]::new($Target) + $this.Target = [GitHubOwner]@{ + Name = $Target + Type = $Type + Url = "https://$HostName/$Target" + } $this.Type = $Type $this.RepositorySelection = $Object.repository_selection $this.Permissions = $Object.permissions @@ -80,5 +88,6 @@ $this.UpdatedAt = $Object.updated_at $this.SuspendedAt = $Object.suspended_at $this.SuspendedBy = [GitHubUser]::new($Object.suspended_by) + $this.Url = "https://$HostName/$($Type.ToLower())s/$Target/settings/installations/$($Object.id)" } } diff --git a/src/formats/GitHubAppInstallation.Format.ps1xml b/src/formats/GitHubAppInstallation.Format.ps1xml new file mode 100644 index 000000000..876cc43b7 --- /dev/null +++ b/src/formats/GitHubAppInstallation.Format.ps1xml @@ -0,0 +1,124 @@ + + + + + GitHubAppInstallationTable + + GitHubAppInstallation + + + + + + + + + + + + + + + + + + + + + + + + + + + + if ($Host.UI.SupportsVirtualTerminal -and + ($env:GITHUB_ACTIONS -ne 'true')) { + $PSStyle.FormatHyperlink($_.ID,$_.Url) + } else { + $_.ID + } + + + + $_.App.Slug + + + + if ($Host.UI.SupportsVirtualTerminal -and + ($env:GITHUB_ACTIONS -ne 'true')) { + $PSStyle.FormatHyperlink($_.Target.Name,$_.Target.Url) + } else { + $_.Target.Name + } + + + + Type + + + CreatedAt + + + UpdatedAt + + + + + + + + GitHubAppInstallationList + + GitHubAppInstallation + + + + + + + ID + + + App + + + Target + + + Type + + + Url + + + RepositorySelection + + + Permissions + + + Events + + + FilePaths + + + CreatedAt + + + UpdatedAt + + + SuspendedAt + + + SuspendedBy + + + + + + + + diff --git a/src/functions/private/Apps/GitHub Apps/Get-GitHubEnterpriseOrganizationAppInstallation.ps1 b/src/functions/private/Apps/GitHub Apps/Get-GitHubEnterpriseOrganizationAppInstallation.ps1 index 79b2f94d5..4609f1fe1 100644 --- a/src/functions/private/Apps/GitHub Apps/Get-GitHubEnterpriseOrganizationAppInstallation.ps1 +++ b/src/functions/private/Apps/GitHub Apps/Get-GitHubEnterpriseOrganizationAppInstallation.ps1 @@ -13,6 +13,9 @@ Gets all GitHub Apps in the organization `github` in the enterprise `msx`. + .OUTPUTS + GitHubAppInstallation + .NOTES [List GitHub Apps installed on an enterprise-owned organization]() #> @@ -58,8 +61,8 @@ } Invoke-GitHubAPI @inputObject | ForEach-Object { - foreach ($installation in $_.Response.installations) { - [GitHubAppInstallation]::new($installation, $Organization, 'Organization') + foreach ($installation in $_.Response) { + [GitHubAppInstallation]::new($installation, $Organization, 'Organization', $context.HostName) } } } diff --git a/src/functions/private/Apps/GitHub Apps/Get-GitHubOrganizationAppInstallation.ps1 b/src/functions/private/Apps/GitHub Apps/Get-GitHubOrganizationAppInstallation.ps1 index 5c63a6866..5df95b3fd 100644 --- a/src/functions/private/Apps/GitHub Apps/Get-GitHubOrganizationAppInstallation.ps1 +++ b/src/functions/private/Apps/GitHub Apps/Get-GitHubOrganizationAppInstallation.ps1 @@ -12,6 +12,9 @@ Gets all GitHub Apps in the organization `github`. + .OUTPUTS + GitHubAppInstallation + .NOTES [List app installations for an organization](https://docs.github.com/rest/orgs/orgs#list-app-installations-for-an-organization) #>