Skip to content

Commit

Permalink
🩹 [Patch]: Rename Url parameter to HomepageUrl and add `Descripti…
Browse files Browse the repository at this point in the history
…on` and `CallbackUrls` parameters for GitHub App creation functions
  • Loading branch information
MariusStorhaug committed Feb 6, 2025
1 parent 6170aad commit eb6b8e3
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@

process {
$inputObject = @{
Context = $Context
APIEndpoint = "/app-manifests/$Code/conversions"
Method = 'GET'
APIEndpoint = "/app-manifests/$Code/conversions"
Context = $Context
}

$response = Invoke-GitHubAPI @inputObject | Select-Object -ExpandProperty Response
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function Invoke-GitHubAppCreationForm {

# The homepage URL of the GitHub App.
[Parameter(Mandatory)]
[string] $Url,
[string] $HomepageUrl,

# Enables webhook support for the GitHub App.
[Parameter()]
Expand Down Expand Up @@ -107,7 +107,7 @@ function Invoke-GitHubAppCreationForm {
# Build the manifest object
$manifest = @{
name = $Name
url = $Url
url = $HomepageUrl
hook_attributes = @{
url = $WebhookURL
active = $WebhookEnabled
Expand Down
44 changes: 25 additions & 19 deletions src/functions/public/Apps/GitHub App/New-GitHubApp.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,24 @@
.NOTES
[GitHub Apps](https://docs.github.com/apps)
#>
#>
[CmdletBinding(DefaultParameterSetName = 'Personal', SupportsShouldProcess)]
param(
# The name of the GitHub App.
[Parameter()]
[string] $Name,

# A brief description of the GitHub App.
[Parameter()]
[string] $Description,

# The main URL of the GitHub App.
[Parameter(Mandatory)]
[string] $Url,
[string] $HomepageUrl,

# List of callback URLs for OAuth authentication.
[Parameter()]
[string[]] $CallbackUrls,

# The webhook URL for event notifications.
[Parameter()]
Expand All @@ -38,18 +46,10 @@
[Parameter()]
[string] $RedirectUrl,

# List of callback URLs for OAuth authentication.
[Parameter()]
[string[]] $CallbackUrls,

# The setup URL for the GitHub App.
[Parameter()]
[string] $SetupUrl,

# A brief description of the GitHub App.
[Parameter()]
[string] $Description,

# Specifies whether the app should be publicly visible.
[Parameter()]
[switch] $Public,
Expand All @@ -70,17 +70,22 @@
[Parameter()]
[switch] $SetupOnUpdate,

# The organization under which the app is being created (Organization parameter set).
[Parameter(ParameterSetName = 'Organization', Mandatory)]
[string] $Organization,

# The enterprise under which the app is being created (Enterprise parameter set).
[Parameter(ParameterSetName = 'Enterprise', Mandatory)]
[string] $Enterprise,

# The organization under which the app is being created (Organization parameter set).
[Parameter(ParameterSetName = 'Organization', Mandatory)]
[string] $Organization,

# The state parameter for additional configuration.
[Parameter()]
[string] $State
[string] $State,

# The context to run the command in. Used to get the details for the API call.
# Can be either a string or a GitHubContext object.
[Parameter()]
[object] $Context = (Get-GitHubContext)
)
begin {
$stackPath = $MyInvocation.MyCommand.Name
Expand All @@ -90,22 +95,23 @@
Write-Verbose 'Initiating GitHub App creation process...'
# Step 1: Send manifest and get the temporary code
$params = @{
Enterprise = $Enterprise
Organization = $Organization
Name = $Name
Url = $Url
HomepageUrl = $HomepageUrl
WebhookEnabled = $WebhookEnabled
WebhookURL = $WebhookURL
RedirectUrl = $RedirectUrl
CallbackUrls = $CallbackUrls
SetupUrl = $SetupUrl
Description = $Description
Public = $Public
Events = $Events
Permissions = $Permissions
RequestOAuthOnInstall = $RequestOAuthOnInstall
SetupOnUpdate = $SetupOnUpdate
Enterprise = $Enterprise
Org = $Organization
Public = $Public
State = $State
Context = $Context
}
$code = Invoke-GitHubAppCreationForm @params

Expand Down

0 comments on commit eb6b8e3

Please sign in to comment.