From e5cb53ce0430ce1c5ba190b4ad8fe03be8420dc1 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sun, 15 Dec 2024 03:43:14 +0100 Subject: [PATCH 01/24] Align para and logging/debug --- .../private/Apps/Get-GitHubAppByName.ps1 | 24 +-- .../Apps/Get-GitHubAuthenticatedApp.ps1 | 32 +++- .../Auth/Context}/Assert-GitHubContext.ps1 | 4 +- .../Auth/Context/Remove-GitHubContext.ps1 | 4 +- .../Auth/Context/Resolve-GitHubContext.ps1 | 48 +++--- .../Auth/Context/Set-GitHubContext.ps1 | 32 ++-- .../Invoke-GitHubDeviceFlowLogin.ps1 | 49 ++++--- .../DeviceFlow/Request-GitHubAccessToken.ps1 | 63 ++++---- .../DeviceFlow/Request-GitHubDeviceCode.ps1 | 49 ++++--- .../Test-GitHubAccessTokenRefreshRequired.ps1 | 24 ++- .../DeviceFlow/Wait-GitHubAccessToken.ps1 | 137 ++++++++++-------- .../Commands/ConvertFrom-GitHubOutput.ps1 | 8 +- .../Commands/ConvertTo-GitHubOutput.ps1 | 59 +++++--- .../Config/Initialize-GitHubConfig.ps1 | 12 +- .../Gitignore/Get-GitHubGitignoreByName.ps1 | 27 +++- .../Gitignore/Get-GitHubGitignoreList.ps1 | 25 +++- .../License/Get-GitHubLicenseByName.ps1 | 27 +++- .../private/License/Get-GitHubLicenseList.ps1 | 28 +++- .../License/Get-GitHubRepositoryLicense.ps1 | 52 ++++--- .../Block-GitHubUserByOrganization.ps1 | 44 ++++-- .../Get-GitHubBlockedUserByOrganization.ps1 | 38 +++-- .../Test-GitHubBlockedUserByOrganization.ps1 | 38 +++-- .../Unblock-GitHubUserByOrganization.ps1 | 33 +++-- .../Get-GitHubAllOrganization.ps1 | 41 ++++-- .../Organization/Get-GitHubMyOrganization.ps1 | 37 +++-- .../Get-GitHubOrganizationByName.ps1 | 30 +++- .../Get-GitHubUserOrganization.ps1 | 38 +++-- .../Assets/Get-GitHubReleaseAssetByID.ps1 | 43 ++++-- .../Get-GitHubReleaseAssetByReleaseID.ps1 | 52 ++++--- .../Releases/Get-GitHubReleaseAll.ps1 | 52 ++++--- .../Releases/Get-GitHubReleaseByID.ps1 | 43 ++++-- .../Releases/Get-GitHubReleaseByTagName.ps1 | 43 ++++-- .../Releases/Get-GitHubReleaseLatest.ps1 | 42 ++++-- .../Get-GitHubRepositoryAutolinkById.ps1 | 42 ++++-- .../Get-GitHubRepositoryAutolinkList.ps1 | 42 ++++-- .../Fork/New-GitHubRepositoryAsFork.ps1 | 69 +++++---- .../Repositories/Get-GitHubMyRepositories.ps1 | 64 ++++---- .../Get-GitHubRepositoryByName.ps1 | 44 ++++-- .../Get-GitHubRepositoryListByID.ps1 | 38 +++-- .../Get-GitHubRepositoryListByOrg.ps1 | 52 ++++--- .../Get-GitHubRepositoryListByUser.ps1 | 52 +++++-- .../New-GitHubRepositoryFromTemplate.ps1 | 63 ++++---- .../Repositories/New-GitHubRepositoryOrg.ps1 | 82 ++++++----- .../Repositories/New-GitHubRepositoryUser.ps1 | 83 +++++------ .../Users/Blocking/Block-GitHubUserByUser.ps1 | 43 ++++-- .../Blocking/Get-GitHubBlockedUserByUser.ps1 | 38 +++-- .../Blocking/Test-GitHubBlockedUserByUser.ps1 | 46 ++++-- .../Blocking/Unblock-GitHubUserByUser.ps1 | 37 +++-- .../Users/Emails/Get-GitHubUserAllEmail.ps1 | 38 +++-- .../Emails/Get-GitHubUserPublicEmail.ps1 | 38 +++-- .../Get-GitHubUserFollowersOfUser.ps1 | 38 +++-- .../Followers/Get-GitHubUserFollowingMe.ps1 | 38 +++-- .../Followers/Get-GitHubUserFollowingUser.ps1 | 38 +++-- .../Followers/Get-GitHubUserMyFollowers.ps1 | 38 +++-- .../Followers/Test-GitHubUserFollowedByMe.ps1 | 39 +++-- .../Test-GitHubUserFollowedByUser.ps1 | 39 +++-- .../GPG-Keys/Get-GitHubUserGpgKeyForUser.ps1 | 38 +++-- .../Users/GPG-Keys/Get-GitHubUserMyGpgKey.ps1 | 38 +++-- .../GPG-Keys/Get-GitHubUserMyGpgKeyById.ps1 | 30 +++- .../private/Users/Get-GitHubAllUser.ps1 | 40 +++-- .../private/Users/Get-GitHubMyUser.ps1 | 30 +++- .../private/Users/Get-GitHubUserByName.ps1 | 30 +++- .../Users/Keys/Get-GitHubUserKeyForUser.ps1 | 38 +++-- .../Users/Keys/Get-GitHubUserMyKey.ps1 | 38 +++-- .../Users/Keys/Get-GitHubUserMyKeyById.ps1 | 30 +++- .../Get-GitHubUserMySigningKey.ps1 | 38 +++-- .../Get-GitHubUserMySigningKeyById.ps1 | 30 +++- .../Get-GitHubUserSigningKeyForUser.ps1 | 38 +++-- .../Get-GitHubMyUserSocials.ps1 | 38 +++-- .../Get-GitHubUserSocialsByName.ps1 | 30 +++- .../public/Actions/Disable-GitHubWorkflow.ps1 | 43 ++++-- .../public/Actions/Enable-GitHubWorkflow.ps1 | 42 ++++-- .../public/Actions/Get-GitHubWorkflow.ps1 | 57 +++++--- .../public/Actions/Get-GitHubWorkflowRun.ps1 | 68 +++++---- .../Actions/Get-GitHubWorkflowUsage.ps1 | 44 ++++-- .../Actions/Remove-GitHubWorkflowRun.ps1 | 47 +++--- .../public/Actions/Start-GitHubWorkflow.ps1 | 57 +++++--- .../Actions/Start-GitHubWorkflowReRun.ps1 | 46 ++++-- .../public/Actions/Stop-GitHubWorkflowRun.ps1 | 46 ++++-- .../public/Apps/GitHub Apps/Get-GitHubApp.ps1 | 3 - .../GitHub Apps/Get-GitHubAppInstallation.ps1 | 30 +++- .../New-GitHubAppInstallationAccessToken.ps1 | 44 ++++-- .../Get-GitHubAppWebhookConfiguration.ps1 | 31 +++- .../Webhooks/Get-GitHubAppWebhookDelivery.ps1 | 30 +++- .../public/Auth/Context/Get-GitHubContext.ps1 | 1 - 85 files changed, 2241 insertions(+), 1213 deletions(-) rename src/functions/{public/Auth => private/Auth/Context}/Assert-GitHubContext.ps1 (92%) rename src/functions/{public => private}/Auth/Context/Remove-GitHubContext.ps1 (92%) rename src/functions/{public => private}/Auth/Context/Set-GitHubContext.ps1 (87%) diff --git a/src/functions/private/Apps/Get-GitHubAppByName.ps1 b/src/functions/private/Apps/Get-GitHubAppByName.ps1 index cf9ac29d..e0c461cd 100644 --- a/src/functions/private/Apps/Get-GitHubAppByName.ps1 +++ b/src/functions/private/Apps/Get-GitHubAppByName.ps1 @@ -32,23 +32,27 @@ begin { $commandName = $MyInvocation.MyCommand.Name - Write-Verbose "[$commandName] - Start" + Write-Debug "[$commandName] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } process { - $inputObject = @{ - Context = $Context - APIEndpoint = "/apps/$AppSlug" - Method = 'GET' - } - - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + try { + $inputObject = @{ + Context = $Context + APIEndpoint = "/apps/$AppSlug" + Method = 'GET' + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ } } end { - Write-Verbose "[$commandName] - End" + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/private/Apps/Get-GitHubAuthenticatedApp.ps1 b/src/functions/private/Apps/Get-GitHubAuthenticatedApp.ps1 index cf0fb44b..f14ced4a 100644 --- a/src/functions/private/Apps/Get-GitHubAuthenticatedApp.ps1 +++ b/src/functions/private/Apps/Get-GitHubAuthenticatedApp.ps1 @@ -29,15 +29,31 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - $inputObject = @{ - Context = $Context - APIEndpoint = '/app' - Method = 'GET' + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType App } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + process { + try { + $Context = Resolve-GitHubContext -Context $Context + + $inputObject = @{ + Context = $Context + APIEndpoint = '/app' + Method = 'GET' + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } + } + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Auth/Assert-GitHubContext.ps1 b/src/functions/private/Auth/Context/Assert-GitHubContext.ps1 similarity index 92% rename from src/functions/public/Auth/Assert-GitHubContext.ps1 rename to src/functions/private/Auth/Context/Assert-GitHubContext.ps1 index ffa46dd3..e101876b 100644 --- a/src/functions/public/Auth/Assert-GitHubContext.ps1 +++ b/src/functions/private/Auth/Context/Assert-GitHubContext.ps1 @@ -27,7 +27,7 @@ begin { $commandName = $MyInvocation.MyCommand.Name - Write-Verbose "[$commandName] - Start" + Write-Debug "[$commandName] - Start" } process { @@ -39,6 +39,6 @@ } end { - Write-Verbose "[$commandName] - End" + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Auth/Context/Remove-GitHubContext.ps1 b/src/functions/private/Auth/Context/Remove-GitHubContext.ps1 similarity index 92% rename from src/functions/public/Auth/Context/Remove-GitHubContext.ps1 rename to src/functions/private/Auth/Context/Remove-GitHubContext.ps1 index abe5a116..653633f8 100644 --- a/src/functions/public/Auth/Context/Remove-GitHubContext.ps1 +++ b/src/functions/private/Auth/Context/Remove-GitHubContext.ps1 @@ -31,7 +31,7 @@ filter Remove-GitHubContext { begin { $commandName = $MyInvocation.MyCommand.Name - Write-Verbose "[$commandName] - Start" + Write-Debug "[$commandName] - Start" $null = Get-GitHubConfig } @@ -44,6 +44,6 @@ filter Remove-GitHubContext { } end { - Write-Verbose "[$commandName] - End" + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/private/Auth/Context/Resolve-GitHubContext.ps1 b/src/functions/private/Auth/Context/Resolve-GitHubContext.ps1 index 1302d806..7bdf2fba 100644 --- a/src/functions/private/Auth/Context/Resolve-GitHubContext.ps1 +++ b/src/functions/private/Auth/Context/Resolve-GitHubContext.ps1 @@ -31,37 +31,41 @@ begin { $commandName = $MyInvocation.MyCommand.Name - Write-Verbose "[$commandName] - Start" + Write-Debug "[$commandName] - Start" Initialize-GitHubConfig } process { - if ($Context -is [string]) { - $contextName = $Context - Write-Verbose "Getting context: [$contextName]" - $Context = Get-GitHubContext -Context $contextName - } + try { + if ($Context -is [string]) { + $contextName = $Context + Write-Debug "Getting context: [$contextName]" + $Context = Get-GitHubContext -Context $contextName + } - if (-not $Context) { - throw "Please provide a valid context or log in using 'Connect-GitHub'." - } + if (-not $Context) { + throw "Please provide a valid context or log in using 'Connect-GitHub'." + } - # switch ($Context.Type) { - # 'App' { - # $availableContexts = Get-GitHubContext -ListAvailable | - # Where-Object { $_.Type -eq 'Installation' -and $_.ClientID -eq $Context.ClientID } - # $params = Get-FunctionParameter -Scope 2 - # Write-Verbose 'Resolving parameters used in called function' - # Write-Verbose ($params | Out-String) - # if ($params.Keys -in 'Owner', 'Organization') { - # $Context = $availableContexts | Where-Object { $_.Owner -eq $params.Owner } - # } - # } - # } + # switch ($Context.Type) { + # 'App' { + # $availableContexts = Get-GitHubContext -ListAvailable | + # Where-Object { $_.Type -eq 'Installation' -and $_.ClientID -eq $Context.ClientID } + # $params = Get-FunctionParameter -Scope 2 + # Write-Debug 'Resolving parameters used in called function' + # Write-Debug ($params | Out-String) + # if ($params.Keys -in 'Owner', 'Organization') { + # $Context = $availableContexts | Where-Object { $_.Owner -eq $params.Owner } + # } + # } + # } + } catch { + throw $_ + } } end { - Write-Verbose "[$commandName] - End" + Write-Debug "[$commandName] - End" Write-Output $Context } } diff --git a/src/functions/public/Auth/Context/Set-GitHubContext.ps1 b/src/functions/private/Auth/Context/Set-GitHubContext.ps1 similarity index 87% rename from src/functions/public/Auth/Context/Set-GitHubContext.ps1 rename to src/functions/private/Auth/Context/Set-GitHubContext.ps1 index cb420df5..e80fa14e 100644 --- a/src/functions/public/Auth/Context/Set-GitHubContext.ps1 +++ b/src/functions/private/Auth/Context/Set-GitHubContext.ps1 @@ -40,22 +40,22 @@ function Set-GitHubContext { begin { $commandName = $MyInvocation.MyCommand.Name - Write-Verbose "[$commandName] - Start" + Write-Debug "[$commandName] - Start" $null = Get-GitHubConfig $contextObj = @{} + $Context } process { - Write-Verbose 'Context:' - $contextObj | Out-String -Stream | ForEach-Object { Write-Verbose $_ } + Write-Debug 'Context:' + $contextObj | Out-String -Stream | ForEach-Object { Write-Debug $_ } # Run functions to get info on the temporary context. try { - Write-Verbose "Getting info on the context [$($contextObj['AuthType'])]." + Write-Debug "Getting info on the context [$($contextObj['AuthType'])]." switch -Regex ($($contextObj['AuthType'])) { 'PAT|UAT|IAT' { $viewer = Get-GitHubViewer -Context $contextObj - $viewer | Out-String -Stream | ForEach-Object { Write-Verbose $_ } + $viewer | Out-String -Stream | ForEach-Object { Write-Debug $_ } if ([string]::IsNullOrEmpty($contextObj['DisplayName'])) { $contextObj['DisplayName'] = [string]$viewer.name } @@ -94,12 +94,12 @@ function Set-GitHubContext { $owner = $gitHubEvent.repository.owner.login $repo = $gitHubEvent.repository.name $gh_sender = $gitHubEvent.sender.login # sender is an automatic variable in Powershell - Write-Verbose "Enterprise: $enterprise" - Write-Verbose "Organization: $organization" - Write-Verbose "Repository: $repo" - Write-Verbose "Repository Owner: $owner" - Write-Verbose "Repository Owner Type: $targetType" - Write-Verbose "Sender: $gh_sender" + Write-Debug "Enterprise: $enterprise" + Write-Debug "Organization: $organization" + Write-Debug "Repository: $repo" + Write-Debug "Repository Owner: $owner" + Write-Debug "Repository Owner Type: $targetType" + Write-Debug "Sender: $gh_sender" if ([string]::IsNullOrEmpty($contextObj['Enterprise'])) { $contextObj['Enterprise'] = [string]$enterprise } @@ -139,11 +139,11 @@ function Set-GitHubContext { throw 'Failed to get info on the context. Unknown logon type.' } } - Write-Verbose "Found [$($contextObj['Type'])] with login: [$($contextObj['Name'])]" - $contextObj | Out-String -Stream | ForEach-Object { Write-Verbose $_ } - Write-Verbose '----------------------------------------------------' + Write-Debug "Found [$($contextObj['Type'])] with login: [$($contextObj['Name'])]" + $contextObj | Out-String -Stream | ForEach-Object { Write-Debug $_ } + Write-Debug '----------------------------------------------------' if ($PSCmdlet.ShouldProcess('Context', 'Set')) { - Write-Verbose "Saving context: [$($script:GitHub.Config.ID)/$($contextObj['Name'])]" + Write-Debug "Saving context: [$($script:GitHub.Config.ID)/$($contextObj['Name'])]" Set-Context -ID "$($script:GitHub.Config.ID)/$($contextObj['Name'])" -Context $contextObj if ($Default) { Set-GitHubDefaultContext -Context $contextObj['Name'] @@ -164,6 +164,6 @@ function Set-GitHubContext { } end { - Write-Verbose "[$commandName] - End" + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/private/Auth/DeviceFlow/Invoke-GitHubDeviceFlowLogin.ps1 b/src/functions/private/Auth/DeviceFlow/Invoke-GitHubDeviceFlowLogin.ps1 index e4b349d3..c2ea74ae 100644 --- a/src/functions/private/Auth/DeviceFlow/Invoke-GitHubDeviceFlowLogin.ps1 +++ b/src/functions/private/Auth/DeviceFlow/Invoke-GitHubDeviceFlowLogin.ps1 @@ -41,25 +41,40 @@ [securestring] $RefreshToken ) - do { - if ($RefreshToken) { - $tokenResponse = Wait-GitHubAccessToken -ClientID $ClientID -RefreshToken $RefreshToken -HostName $HostName - } else { - $deviceCodeResponse = Request-GitHubDeviceCode -ClientID $ClientID -Scope $Scope -HostName $HostName + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + } - $deviceCode = $deviceCodeResponse.device_code - $interval = $deviceCodeResponse.interval - $userCode = $deviceCodeResponse.user_code - $verificationUri = $deviceCodeResponse.verification_uri + process { + try { + do { + if ($RefreshToken) { + $tokenResponse = Wait-GitHubAccessToken -ClientID $ClientID -RefreshToken $RefreshToken -HostName $HostName + } else { + $deviceCodeResponse = Request-GitHubDeviceCode -ClientID $ClientID -Scope $Scope -HostName $HostName - Write-Host '! ' -ForegroundColor DarkYellow -NoNewline - Write-Host "We added the code to your clipboard: [$userCode]" - $userCode | Set-Clipboard - Read-Host "Press Enter to open $HostName in your browser..." - Start-Process $verificationUri + $deviceCode = $deviceCodeResponse.device_code + $interval = $deviceCodeResponse.interval + $userCode = $deviceCodeResponse.user_code + $verificationUri = $deviceCodeResponse.verification_uri - $tokenResponse = Wait-GitHubAccessToken -DeviceCode $deviceCode -ClientID $ClientID -Interval $interval -HostName $HostName + Write-Host '! ' -ForegroundColor DarkYellow -NoNewline + Write-Host "We added the code to your clipboard: [$userCode]" + $userCode | Set-Clipboard + Read-Host "Press Enter to open $HostName in your browser..." + Start-Process $verificationUri + + $tokenResponse = Wait-GitHubAccessToken -DeviceCode $deviceCode -ClientID $ClientID -Interval $interval -HostName $HostName + } + } while ($tokenResponse.error) + $tokenResponse + } catch { + throw $_ } - } while ($tokenResponse.error) - $tokenResponse + } + + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/private/Auth/DeviceFlow/Request-GitHubAccessToken.ps1 b/src/functions/private/Auth/DeviceFlow/Request-GitHubAccessToken.ps1 index c193c81d..289f7de7 100644 --- a/src/functions/private/Auth/DeviceFlow/Request-GitHubAccessToken.ps1 +++ b/src/functions/private/Auth/DeviceFlow/Request-GitHubAccessToken.ps1 @@ -42,40 +42,51 @@ [string] $HostName ) - $body = @{ - 'client_id' = $ClientID + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" } - if ($PSBoundParameters.ContainsKey('RefreshToken')) { - $body += @{ - 'refresh_token' = (ConvertFrom-SecureString $RefreshToken -AsPlainText) - 'grant_type' = 'refresh_token' + process { + $body = @{ + 'client_id' = $ClientID } - } - if ($PSBoundParameters.ContainsKey('DeviceCode')) { - $body += @{ - 'device_code' = $DeviceCode - 'grant_type' = 'urn:ietf:params:oauth:grant-type:device_code' + if ($PSBoundParameters.ContainsKey('RefreshToken')) { + $body += @{ + 'refresh_token' = (ConvertFrom-SecureString $RefreshToken -AsPlainText) + 'grant_type' = 'refresh_token' + } } - } - $RESTParams = @{ - Uri = "https://$HostName/login/oauth/access_token" - Method = 'POST' - Body = $body - Headers = @{ 'Accept' = 'application/json' } - } + if ($PSBoundParameters.ContainsKey('DeviceCode')) { + $body += @{ + 'device_code' = $DeviceCode + 'grant_type' = 'urn:ietf:params:oauth:grant-type:device_code' + } + } - try { - Write-Debug ($RESTParams.GetEnumerator() | Out-String) + $RESTParams = @{ + Uri = "https://$HostName/login/oauth/access_token" + Method = 'POST' + Body = $body + Headers = @{ 'Accept' = 'application/json' } + } - $tokenResponse = Invoke-RestMethod @RESTParams -Verbose:$false + try { + Write-Debug ($RESTParams.GetEnumerator() | Out-String) + + $tokenResponse = Invoke-RestMethod @RESTParams -Verbose:$false + + Write-Debug ($tokenResponse | ConvertTo-Json | Out-String) + return $tokenResponse + } catch { + Write-Error $_ + throw $_ + } + } - Write-Debug ($tokenResponse | ConvertTo-Json | Out-String) - return $tokenResponse - } catch { - Write-Error $_ - throw $_ + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/private/Auth/DeviceFlow/Request-GitHubDeviceCode.ps1 b/src/functions/private/Auth/DeviceFlow/Request-GitHubDeviceCode.ps1 index 28280f0a..117297cf 100644 --- a/src/functions/private/Auth/DeviceFlow/Request-GitHubDeviceCode.ps1 +++ b/src/functions/private/Auth/DeviceFlow/Request-GitHubDeviceCode.ps1 @@ -34,29 +34,40 @@ [string] $HostName ) - $headers = @{ - Accept = 'application/json' + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" } - $body = @{ - client_id = $ClientID - scope = $Scope - } + process { + $headers = @{ + Accept = 'application/json' + } - $RESTParams = @{ - Uri = "https://$HostName/login/device/code" - Method = 'POST' - Body = $body - Headers = $headers - } + $body = @{ + client_id = $ClientID + scope = $Scope + } + + $RESTParams = @{ + Uri = "https://$HostName/login/device/code" + Method = 'POST' + Body = $body + Headers = $headers + } - try { - Write-Debug ($RESTParams.GetEnumerator() | Out-String) + try { + Write-Debug ($RESTParams.GetEnumerator() | Out-String) + + $deviceCodeResponse = Invoke-RestMethod @RESTParams -Verbose:$false + return $deviceCodeResponse + } catch { + Write-Error $_ + throw $_ + } + } - $deviceCodeResponse = Invoke-RestMethod @RESTParams -Verbose:$false - return $deviceCodeResponse - } catch { - Write-Error $_ - throw $_ + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/private/Auth/DeviceFlow/Test-GitHubAccessTokenRefreshRequired.ps1 b/src/functions/private/Auth/DeviceFlow/Test-GitHubAccessTokenRefreshRequired.ps1 index bba2179d..e2d04b00 100644 --- a/src/functions/private/Auth/DeviceFlow/Test-GitHubAccessTokenRefreshRequired.ps1 +++ b/src/functions/private/Auth/DeviceFlow/Test-GitHubAccessTokenRefreshRequired.ps1 @@ -20,10 +20,24 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - $tokenExpirationDate = $Context.TokenExpirationDate - $currentDateTime = Get-Date - $remainingDuration = [datetime]$tokenExpirationDate - $currentDateTime + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + } - $remainingDuration.TotalHours -lt $script:GitHub.Config.AccessTokenGracePeriodInHours + process { + try { + $tokenExpirationDate = $Context.TokenExpirationDate + $currentDateTime = Get-Date + $remainingDuration = [datetime]$tokenExpirationDate - $currentDateTime + $remainingDuration.TotalHours -lt $script:GitHub.Config.AccessTokenGracePeriodInHours + } catch { + throw $_ + } + } + + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/private/Auth/DeviceFlow/Wait-GitHubAccessToken.ps1 b/src/functions/private/Auth/DeviceFlow/Wait-GitHubAccessToken.ps1 index 74d60286..a02490a3 100644 --- a/src/functions/private/Auth/DeviceFlow/Wait-GitHubAccessToken.ps1 +++ b/src/functions/private/Auth/DeviceFlow/Wait-GitHubAccessToken.ps1 @@ -49,68 +49,83 @@ [int] $Interval = 5 ) - do { - if ($RefreshToken) { - $response = Request-GitHubAccessToken -ClientID $ClientID -RefreshToken $RefreshToken -HostName $HostName - } else { - $response = Request-GitHubAccessToken -ClientID $ClientID -DeviceCode $DeviceCode -HostName $HostName - } - if ($response.error) { - switch ($response.error) { - 'authorization_pending' { - # The user has not yet entered the code. - # Wait, then poll again. - Write-Debug $response.error_description - Start-Sleep -Seconds $interval - continue - } - 'slow_down' { - # The app polled too fast. - # Wait for the interval plus 5 seconds, then poll again. - Write-Debug $response.error_description - Start-Sleep -Seconds ($interval + 5) - continue - } - 'expired_token' { - # The 'device_code' expired, and the process needs to restart. - Write-Error $response.error_description - exit 1 - } - 'unsupported_grant_type' { - # The 'grant_type' is not supported. - Write-Error $response.error_description - exit 1 - } - 'incorrect_client_credentials' { - # The 'client_id' is not valid. - Write-Error $response.error_description - exit 1 - } - 'incorrect_device_code' { - # The 'device_code' is not valid. - Write-Error $response.error_description - exit 2 - } - 'access_denied' { - # The user cancelled the process. Stop polling. - Write-Error $response.error_description - exit 1 - } - 'device_flow_disabled' { - # The GitHub App does not support the Device Flow. - Write-Error $response.error_description - exit 1 + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + } + + process { + try { + do { + if ($RefreshToken) { + $response = Request-GitHubAccessToken -ClientID $ClientID -RefreshToken $RefreshToken -HostName $HostName + } else { + $response = Request-GitHubAccessToken -ClientID $ClientID -DeviceCode $DeviceCode -HostName $HostName } - default { - # The response contains an access token. Stop polling. - Write-Error 'Unknown error:' - Write-Error $response.error - Write-Error $response.error_description - Write-Error $response.error_uri - break + if ($response.error) { + switch ($response.error) { + 'authorization_pending' { + # The user has not yet entered the code. + # Wait, then poll again. + Write-Debug $response.error_description + Start-Sleep -Seconds $interval + continue + } + 'slow_down' { + # The app polled too fast. + # Wait for the interval plus 5 seconds, then poll again. + Write-Debug $response.error_description + Start-Sleep -Seconds ($interval + 5) + continue + } + 'expired_token' { + # The 'device_code' expired, and the process needs to restart. + Write-Error $response.error_description + exit 1 + } + 'unsupported_grant_type' { + # The 'grant_type' is not supported. + Write-Error $response.error_description + exit 1 + } + 'incorrect_client_credentials' { + # The 'client_id' is not valid. + Write-Error $response.error_description + exit 1 + } + 'incorrect_device_code' { + # The 'device_code' is not valid. + Write-Error $response.error_description + exit 2 + } + 'access_denied' { + # The user cancelled the process. Stop polling. + Write-Error $response.error_description + exit 1 + } + 'device_flow_disabled' { + # The GitHub App does not support the Device Flow. + Write-Error $response.error_description + exit 1 + } + default { + # The response contains an access token. Stop polling. + Write-Error 'Unknown error:' + Write-Error $response.error + Write-Error $response.error_description + Write-Error $response.error_uri + break + } + } } - } + } until ($response.access_token) + $response + } catch { + throw $_ } - } until ($response.access_token) - $response + } + + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/private/Commands/ConvertFrom-GitHubOutput.ps1 b/src/functions/private/Commands/ConvertFrom-GitHubOutput.ps1 index f267a7d4..4d0c00ec 100644 --- a/src/functions/private/Commands/ConvertFrom-GitHubOutput.ps1 +++ b/src/functions/private/Commands/ConvertFrom-GitHubOutput.ps1 @@ -49,6 +49,8 @@ ) begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" $lines = @() } @@ -128,8 +130,10 @@ $i++ } if ($AsHashtable) { - return $result + $result + } else { + [PSCustomObject]$result } - [PSCustomObject]$result + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/private/Commands/ConvertTo-GitHubOutput.ps1 b/src/functions/private/Commands/ConvertTo-GitHubOutput.ps1 index 0b9d7236..a2016556 100644 --- a/src/functions/private/Commands/ConvertTo-GitHubOutput.ps1 +++ b/src/functions/private/Commands/ConvertTo-GitHubOutput.ps1 @@ -46,32 +46,47 @@ [object] $InputObject ) - $outputLines = @() - - if ($InputObject -is [hashtable]) { - $InputObject = [PSCustomObject]$InputObject + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" } - foreach ($property in $InputObject.PSObject.Properties) { - $key = $property.Name - $value = $property.Value + process { + try { + $outputLines = @() - # Convert hashtable or PSCustomObject to compressed JSON - if ($value -is [hashtable] -or $value -is [PSCustomObject]) { - $value = $value | ConvertTo-Json -Compress - } + if ($InputObject -is [hashtable]) { + $InputObject = [PSCustomObject]$InputObject + } + + foreach ($property in $InputObject.PSObject.Properties) { + $key = $property.Name + $value = $property.Value - if ($value -is [string] -and $value.Contains("`n")) { - # Multi-line value - $guid = [Guid]::NewGuid().ToString() - $EOFMarker = "EOF_$guid" - $outputLines += "$key<<$EOFMarker" - $outputLines += $value - $outputLines += $EOFMarker - } else { - # Single-line value - $outputLines += "$key=$value" + # Convert hashtable or PSCustomObject to compressed JSON + if ($value -is [hashtable] -or $value -is [PSCustomObject]) { + $value = $value | ConvertTo-Json -Compress + } + + if ($value -is [string] -and $value.Contains("`n")) { + # Multi-line value + $guid = [Guid]::NewGuid().ToString() + $EOFMarker = "EOF_$guid" + $outputLines += "$key<<$EOFMarker" + $outputLines += $value + $outputLines += $EOFMarker + } else { + # Single-line value + $outputLines += "$key=$value" + } + } + $outputLines + } catch { + throw $_ } } - $outputLines + + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/private/Config/Initialize-GitHubConfig.ps1 b/src/functions/private/Config/Initialize-GitHubConfig.ps1 index 4bbc8bab..e99769f9 100644 --- a/src/functions/private/Config/Initialize-GitHubConfig.ps1 +++ b/src/functions/private/Config/Initialize-GitHubConfig.ps1 @@ -29,24 +29,24 @@ } process { - Write-Verbose "GitHubConfig ID: [$($script:GitHub.Config.ID)]" - Write-Verbose "Force: [$Force]" + Write-Debug "GitHubConfig ID: [$($script:GitHub.Config.ID)]" + Write-Debug "Force: [$Force]" if (-not $script:GitHub.Config.ID -or $Force) { try { - Write-Verbose 'Attempt to load the stored GitHubConfig from ContextVault' + Write-Debug 'Attempt to load the stored GitHubConfig from ContextVault' $context = [GitHubConfig](Get-Context -ID $script:GitHub.Config.ID) if (-not $context -or $Force) { - Write-Verbose 'No stored config found. Loading GitHubConfig from defaults' + Write-Debug 'No stored config found. Loading GitHubConfig from defaults' $context = Set-Context -ID $script:GitHub.DefaultConfig.ID -Context $script:GitHub.DefaultConfig -PassThru } - Write-Verbose 'GitHubConfig loaded into memory.' + Write-Debug 'GitHubConfig loaded into memory.' $script:GitHub.Config = [GitHubConfig]$context } catch { Write-Error $_ throw 'Failed to initialize GitHub config' } } else { - Write-Verbose 'GitHubConfig already initialized and available in memory.' + Write-Debug 'GitHubConfig already initialized and available in memory.' } } diff --git a/src/functions/private/Gitignore/Get-GitHubGitignoreByName.ps1 b/src/functions/private/Gitignore/Get-GitHubGitignoreByName.ps1 index 777cb263..f5371d92 100644 --- a/src/functions/private/Gitignore/Get-GitHubGitignoreByName.ps1 +++ b/src/functions/private/Gitignore/Get-GitHubGitignoreByName.ps1 @@ -28,19 +28,30 @@ ) begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } process { - $inputObject = @{ - Context = $Context - APIEndpoint = "/gitignore/templates/$Name" - Accept = 'application/vnd.github.raw+json' - Method = 'GET' + try { + $inputObject = @{ + Context = $Context + APIEndpoint = "/gitignore/templates/$Name" + Accept = 'application/vnd.github.raw+json' + Method = 'GET' + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ } + } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response - } + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/private/Gitignore/Get-GitHubGitignoreList.ps1 b/src/functions/private/Gitignore/Get-GitHubGitignoreList.ps1 index 1f522c51..9dc4690f 100644 --- a/src/functions/private/Gitignore/Get-GitHubGitignoreList.ps1 +++ b/src/functions/private/Gitignore/Get-GitHubGitignoreList.ps1 @@ -26,18 +26,29 @@ ) begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } process { - $inputObject = @{ - Context = $Context - APIEndpoint = '/gitignore/templates' - Method = 'GET' + try { + $inputObject = @{ + Context = $Context + APIEndpoint = '/gitignore/templates' + Method = 'GET' + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ } + } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response - } + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/private/License/Get-GitHubLicenseByName.ps1 b/src/functions/private/License/Get-GitHubLicenseByName.ps1 index e14974dd..847534ad 100644 --- a/src/functions/private/License/Get-GitHubLicenseByName.ps1 +++ b/src/functions/private/License/Get-GitHubLicenseByName.ps1 @@ -31,19 +31,30 @@ ) begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } process { - $inputObject = @{ - Context = $Context - APIEndpoint = "/licenses/$Name" - Accept = 'application/vnd.github+json' - Method = 'GET' + try { + $inputObject = @{ + Context = $Context + APIEndpoint = "/licenses/$Name" + Accept = 'application/vnd.github+json' + Method = 'GET' + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ } + } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response - } + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/private/License/Get-GitHubLicenseList.ps1 b/src/functions/private/License/Get-GitHubLicenseList.ps1 index 6cefaf8b..d351783a 100644 --- a/src/functions/private/License/Get-GitHubLicenseList.ps1 +++ b/src/functions/private/License/Get-GitHubLicenseList.ps1 @@ -25,14 +25,30 @@ [string] $Context ) - $inputObject = @{ - Context = $Context - APIEndpoint = '/licenses' - Method = 'GET' + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + process { + try { + $inputObject = @{ + Context = $Context + APIEndpoint = '/licenses' + Method = 'GET' + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/private/License/Get-GitHubRepositoryLicense.ps1 b/src/functions/private/License/Get-GitHubRepositoryLicense.ps1 index 351daa60..7883c464 100644 --- a/src/functions/private/License/Get-GitHubRepositoryLicense.ps1 +++ b/src/functions/private/License/Get-GitHubRepositoryLicense.ps1 @@ -34,29 +34,43 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner - } - Write-Debug "Owner : [$($Context.Owner)]" + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo + } + Write-Debug "Repo : [$($Context.Repo)]" } - Write-Debug "Repo : [$($Context.Repo)]" - $inputObject = @{ - Context = $Context - APIEndpoint = "/repos/$Owner/$Repo/license" - Accept = 'application/vnd.github+json' - Method = 'GET' - } + process { + try { + $inputObject = @{ + Context = $Context + APIEndpoint = "/repos/$Owner/$Repo/license" + Accept = 'application/vnd.github+json' + Method = 'GET' + } - Invoke-GitHubAPI @inputObject | ForEach-Object { - $Response = $_.Response - $rawContent = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($Response.content)) - $Response | Add-Member -NotePropertyName 'raw_content' -NotePropertyValue $rawContent -Force - $Response + Invoke-GitHubAPI @inputObject | ForEach-Object { + $Response = $_.Response + $rawContent = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($Response.content)) + $Response | Add-Member -NotePropertyName 'raw_content' -NotePropertyValue $rawContent -Force + $Response + } + } catch { + throw $_ + } + } + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/private/Organization/Blocking/Block-GitHubUserByOrganization.ps1 b/src/functions/private/Organization/Blocking/Block-GitHubUserByOrganization.ps1 index e57d6334..9fc809f1 100644 --- a/src/functions/private/Organization/Blocking/Block-GitHubUserByOrganization.ps1 +++ b/src/functions/private/Organization/Blocking/Block-GitHubUserByOrganization.ps1 @@ -44,24 +44,36 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - $inputObject = @{ - Context = $Context - APIEndpoint = "/orgs/$Organization/blocks/$Username" - Method = 'PUT' + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } - try { - $null = (Invoke-GitHubAPI @inputObject) - # Should we check if user is already blocked and return true if so? - return $true - } catch { - if ($_.Exception.Response.StatusCode.Value__ -eq 422) { - return $false - } else { - Write-Error $_.Exception.Response - throw $_ + process { + $inputObject = @{ + Context = $Context + APIEndpoint = "/orgs/$Organization/blocks/$Username" + Method = 'PUT' + } + + try { + $null = (Invoke-GitHubAPI @inputObject) + # Should we check if user is already blocked and return true if so? + return $true + } catch { + if ($_.Exception.Response.StatusCode.Value__ -eq 422) { + return $false + } else { + Write-Error $_.Exception.Response + throw $_ + } } } + + end { + Write-Debug "[$commandName] - End" + } } + diff --git a/src/functions/private/Organization/Blocking/Get-GitHubBlockedUserByOrganization.ps1 b/src/functions/private/Organization/Blocking/Get-GitHubBlockedUserByOrganization.ps1 index bdcac202..5d21ed3c 100644 --- a/src/functions/private/Organization/Blocking/Get-GitHubBlockedUserByOrganization.ps1 +++ b/src/functions/private/Organization/Blocking/Get-GitHubBlockedUserByOrganization.ps1 @@ -35,20 +35,34 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - $body = @{ - per_page = $PerPage + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } - $inputObject = @{ - Context = $Context - APIEndpoint = "/orgs/$Organization/blocks" - Method = 'GET' - Body = $body - } + process { + try { + $body = @{ + per_page = $PerPage + } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + $inputObject = @{ + Context = $Context + APIEndpoint = "/orgs/$Organization/blocks" + Method = 'GET' + Body = $body + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } + } + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/private/Organization/Blocking/Test-GitHubBlockedUserByOrganization.ps1 b/src/functions/private/Organization/Blocking/Test-GitHubBlockedUserByOrganization.ps1 index b838e199..a13f8777 100644 --- a/src/functions/private/Organization/Blocking/Test-GitHubBlockedUserByOrganization.ps1 +++ b/src/functions/private/Organization/Blocking/Test-GitHubBlockedUserByOrganization.ps1 @@ -43,21 +43,33 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - $inputObject = @{ - Context = $Context - APIEndpoint = "/orgs/$Organization/blocks/$Username" - Method = 'GET' + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } - try { - (Invoke-GitHubAPI @inputObject).StatusCode -eq 204 - } catch { - if ($_.Exception.Response.StatusCode.Value__ -eq 404) { - return $false - } else { - throw $_ + process { + $inputObject = @{ + Context = $Context + APIEndpoint = "/orgs/$Organization/blocks/$Username" + Method = 'GET' + } + + try { + (Invoke-GitHubAPI @inputObject).StatusCode -eq 204 + } catch { + if ($_.Exception.Response.StatusCode.Value__ -eq 404) { + return $false + } else { + throw $_ + } } } + + end { + Write-Debug "[$commandName] - End" + } } + diff --git a/src/functions/private/Organization/Blocking/Unblock-GitHubUserByOrganization.ps1 b/src/functions/private/Organization/Blocking/Unblock-GitHubUserByOrganization.ps1 index 18314fb3..95b20730 100644 --- a/src/functions/private/Organization/Blocking/Unblock-GitHubUserByOrganization.ps1 +++ b/src/functions/private/Organization/Blocking/Unblock-GitHubUserByOrganization.ps1 @@ -44,19 +44,30 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + } + + process { + $inputObject = @{ + Context = $Context + APIEndpoint = "/orgs/$Organization/blocks/$Username" + Method = 'DELETE' + } - $inputObject = @{ - Context = $Context - APIEndpoint = "/orgs/$Organization/blocks/$Username" - Method = 'DELETE' + try { + $null = (Invoke-GitHubAPI @inputObject) + return $true + } catch { + Write-Error $_.Exception.Response + throw $_ + } } - try { - $null = (Invoke-GitHubAPI @inputObject) - return $true - } catch { - Write-Error $_.Exception.Response - throw $_ + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/private/Organization/Get-GitHubAllOrganization.ps1 b/src/functions/private/Organization/Get-GitHubAllOrganization.ps1 index 2c5f4fb5..d42d8f5b 100644 --- a/src/functions/private/Organization/Get-GitHubAllOrganization.ps1 +++ b/src/functions/private/Organization/Get-GitHubAllOrganization.ps1 @@ -37,22 +37,35 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - $body = @{ - since = $Since - per_page = $PerPage + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } - $inputObject = @{ - Context = $Context - APIEndpoint = '/organizations' - Method = 'GET' - Body = $body - } + process { + try { + $body = @{ + since = $Since + per_page = $PerPage + } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response - } + $inputObject = @{ + Context = $Context + APIEndpoint = '/organizations' + Method = 'GET' + Body = $body + } + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } + } + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/private/Organization/Get-GitHubMyOrganization.ps1 b/src/functions/private/Organization/Get-GitHubMyOrganization.ps1 index 1a514936..4290e6cc 100644 --- a/src/functions/private/Organization/Get-GitHubMyOrganization.ps1 +++ b/src/functions/private/Organization/Get-GitHubMyOrganization.ps1 @@ -36,20 +36,35 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - $body = @{ - per_page = $PerPage + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } - $inputObject = @{ - Context = $Context - APIEndpoint = '/user/orgs' - Method = 'GET' - Body = $body + process { + try { + $body = @{ + per_page = $PerPage + } + + $inputObject = @{ + Context = $Context + APIEndpoint = '/user/orgs' + Method = 'GET' + Body = $body + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/private/Organization/Get-GitHubOrganizationByName.ps1 b/src/functions/private/Organization/Get-GitHubOrganizationByName.ps1 index b7826882..424cb923 100644 --- a/src/functions/private/Organization/Get-GitHubOrganizationByName.ps1 +++ b/src/functions/private/Organization/Get-GitHubOrganizationByName.ps1 @@ -42,15 +42,29 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - $inputObject = @{ - Context = $Context - APIEndpoint = "/orgs/$Organization" - Method = 'GET' + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + process { + try { + $inputObject = @{ + Context = $Context + APIEndpoint = "/orgs/$Organization" + Method = 'GET' + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } + } + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/private/Organization/Get-GitHubUserOrganization.ps1 b/src/functions/private/Organization/Get-GitHubUserOrganization.ps1 index a3544e76..e4bdc5c6 100644 --- a/src/functions/private/Organization/Get-GitHubUserOrganization.ps1 +++ b/src/functions/private/Organization/Get-GitHubUserOrganization.ps1 @@ -38,20 +38,34 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - $body = @{ - per_page = $PerPage + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } - $inputObject = @{ - Context = $Context - APIEndpoint = "/users/$Username/orgs" - Method = 'GET' - Body = $body - } + process { + try { + $body = @{ + per_page = $PerPage + } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + $inputObject = @{ + Context = $Context + APIEndpoint = "/users/$Username/orgs" + Method = 'GET' + Body = $body + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } + } + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/private/Releases/Assets/Get-GitHubReleaseAssetByID.ps1 b/src/functions/private/Releases/Assets/Get-GitHubReleaseAssetByID.ps1 index 6bcbbf6d..07ae996f 100644 --- a/src/functions/private/Releases/Assets/Get-GitHubReleaseAssetByID.ps1 +++ b/src/functions/private/Releases/Assets/Get-GitHubReleaseAssetByID.ps1 @@ -39,25 +39,40 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo + } + Write-Debug "Repo : [$($Context.Repo)]" } - Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo - } - Write-Debug "Repo : [$($Context.Repo)]" + process { + try { + + $inputObject = @{ + Context = $Context + APIEndpoint = "/repos/$Owner/$Repo/releases/assets/$ID" + Method = 'GET' + } - $inputObject = @{ - Context = $Context - APIEndpoint = "/repos/$Owner/$Repo/releases/assets/$ID" - Method = 'GET' + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/private/Releases/Assets/Get-GitHubReleaseAssetByReleaseID.ps1 b/src/functions/private/Releases/Assets/Get-GitHubReleaseAssetByReleaseID.ps1 index 3fa1252a..782f71f7 100644 --- a/src/functions/private/Releases/Assets/Get-GitHubReleaseAssetByReleaseID.ps1 +++ b/src/functions/private/Releases/Assets/Get-GitHubReleaseAssetByReleaseID.ps1 @@ -44,29 +44,43 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner - } - Write-Debug "Owner : [$($Context.Owner)]" + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo + } + Write-Debug "Repo : [$($Context.Repo)]" } - Write-Debug "Repo : [$($Context.Repo)]" - $body = @{ - per_page = $PerPage - } + process { + try { + $body = @{ + per_page = $PerPage + } - $inputObject = @{ - Context = $Context - APIEndpoint = "/repos/$Owner/$Repo/releases/$ID/assets" - Method = 'GET' - Body = $body - } + $inputObject = @{ + Context = $Context + APIEndpoint = "/repos/$Owner/$Repo/releases/$ID/assets" + Method = 'GET' + Body = $body + } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } + } + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/private/Releases/Releases/Get-GitHubReleaseAll.ps1 b/src/functions/private/Releases/Releases/Get-GitHubReleaseAll.ps1 index e1305754..f90945c1 100644 --- a/src/functions/private/Releases/Releases/Get-GitHubReleaseAll.ps1 +++ b/src/functions/private/Releases/Releases/Get-GitHubReleaseAll.ps1 @@ -38,31 +38,43 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo + } + Write-Debug "Repo : [$($Context.Repo)]" } - Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo - } - Write-Debug "Repo : [$($Context.Repo)]" + process { + try { + $body = @{ + per_page = $PerPage + } - $body = @{ - per_page = $PerPage - } + $inputObject = @{ + Context = $Context + APIEndpoint = "/repos/$Owner/$Repo/releases" + Method = 'GET' + Body = $body + } - $inputObject = @{ - Context = $Context - APIEndpoint = "/repos/$Owner/$Repo/releases" - Method = 'GET' - Body = $body + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } - - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + end { + Write-Debug "[$commandName] - End" } - } diff --git a/src/functions/private/Releases/Releases/Get-GitHubReleaseByID.ps1 b/src/functions/private/Releases/Releases/Get-GitHubReleaseByID.ps1 index c80412ba..73ff06d8 100644 --- a/src/functions/private/Releases/Releases/Get-GitHubReleaseByID.ps1 +++ b/src/functions/private/Releases/Releases/Get-GitHubReleaseByID.ps1 @@ -37,26 +37,39 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo + } + Write-Debug "Repo : [$($Context.Repo)]" } - Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo - } - Write-Debug "Repo : [$($Context.Repo)]" + process { + try { + $inputObject = @{ + Context = $Context + APIEndpoint = "/repos/$Owner/$Repo/releases/$ID" + Method = 'GET' + } - $inputObject = @{ - Context = $Context - APIEndpoint = "/repos/$Owner/$Repo/releases/$ID" - Method = 'GET' + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + end { + Write-Debug "[$commandName] - End" } - } diff --git a/src/functions/private/Releases/Releases/Get-GitHubReleaseByTagName.ps1 b/src/functions/private/Releases/Releases/Get-GitHubReleaseByTagName.ps1 index e6befa41..4ba2856a 100644 --- a/src/functions/private/Releases/Releases/Get-GitHubReleaseByTagName.ps1 +++ b/src/functions/private/Releases/Releases/Get-GitHubReleaseByTagName.ps1 @@ -36,26 +36,39 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo + } + Write-Debug "Repo : [$($Context.Repo)]" } - Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo - } - Write-Debug "Repo : [$($Context.Repo)]" + process { + try { + $inputObject = @{ + Context = $Context + APIEndpoint = "/repos/$Owner/$Repo/releases/tags/$Tag" + Method = 'GET' + } - $inputObject = @{ - Context = $Context - APIEndpoint = "/repos/$Owner/$Repo/releases/tags/$Tag" - Method = 'GET' + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + end { + Write-Debug "[$commandName] - End" } - } diff --git a/src/functions/private/Releases/Releases/Get-GitHubReleaseLatest.ps1 b/src/functions/private/Releases/Releases/Get-GitHubReleaseLatest.ps1 index 738f6fb5..631912de 100644 --- a/src/functions/private/Releases/Releases/Get-GitHubReleaseLatest.ps1 +++ b/src/functions/private/Releases/Releases/Get-GitHubReleaseLatest.ps1 @@ -33,25 +33,39 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo + } + Write-Debug "Repo : [$($Context.Repo)]" } - Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo - } - Write-Debug "Repo : [$($Context.Repo)]" + process { + try { + $inputObject = @{ + Context = $Context + APIEndpoint = "/repos/$Owner/$Repo/releases/latest" + Method = 'GET' + } - $inputObject = @{ - Context = $Context - APIEndpoint = "/repos/$Owner/$Repo/releases/latest" - Method = 'GET' + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/private/Repositories/Autolinks/Get-GitHubRepositoryAutolinkById.ps1 b/src/functions/private/Repositories/Autolinks/Get-GitHubRepositoryAutolinkById.ps1 index 1557c4ce..58bbabf5 100644 --- a/src/functions/private/Repositories/Autolinks/Get-GitHubRepositoryAutolinkById.ps1 +++ b/src/functions/private/Repositories/Autolinks/Get-GitHubRepositoryAutolinkById.ps1 @@ -40,25 +40,39 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo + } + Write-Debug "Repo : [$($Context.Repo)]" } - Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo - } - Write-Debug "Repo : [$($Context.Repo)]" + process { + try { + $inputObject = @{ + Context = $Context + APIEndpoint = "/repos/$Owner/$Repo/autolinks/$AutolinkId" + Method = 'GET' + } - $inputObject = @{ - Context = $Context - APIEndpoint = "/repos/$Owner/$Repo/autolinks/$AutolinkId" - Method = 'GET' + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/private/Repositories/Autolinks/Get-GitHubRepositoryAutolinkList.ps1 b/src/functions/private/Repositories/Autolinks/Get-GitHubRepositoryAutolinkList.ps1 index 92a44ed3..97d45991 100644 --- a/src/functions/private/Repositories/Autolinks/Get-GitHubRepositoryAutolinkList.ps1 +++ b/src/functions/private/Repositories/Autolinks/Get-GitHubRepositoryAutolinkList.ps1 @@ -34,25 +34,39 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo + } + Write-Debug "Repo : [$($Context.Repo)]" } - Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo - } - Write-Debug "Repo : [$($Context.Repo)]" + process { + try { + $inputObject = @{ + Context = $Context + APIEndpoint = "/repos/$Owner/$Repo/autolinks" + Method = 'GET' + } - $inputObject = @{ - Context = $Context - APIEndpoint = "/repos/$Owner/$Repo/autolinks" - Method = 'GET' + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/private/Repositories/Fork/New-GitHubRepositoryAsFork.ps1 b/src/functions/private/Repositories/Fork/New-GitHubRepositoryAsFork.ps1 index 3538e5ac..999b4155 100644 --- a/src/functions/private/Repositories/Fork/New-GitHubRepositoryAsFork.ps1 +++ b/src/functions/private/Repositories/Fork/New-GitHubRepositoryAsFork.ps1 @@ -68,38 +68,53 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - if ([string]::IsNullorEmpty($Name)) { - $Name = $Repo - } - - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner - } - Write-Debug "Owner : [$($Context.Owner)]" + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo - } - Write-Debug "Repo : [$($Context.Repo)]" + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo + } + Write-Debug "Repo : [$($Context.Repo)]" - $body = @{ - organization = $Organization - name = $Name - default_branch_only = $DefaultBranchOnly + if ([string]::IsNullorEmpty($Name)) { + $Name = $Repo + } + Write-Debug "Name : [$Name]" } - $inputObject = @{ - Context = $Context - APIEndpoint = "/repos/$Owner/$Repo/forks" - Method = 'POST' - Body = $body + process { + try { + $body = @{ + organization = $Organization + name = $Name + default_branch_only = $DefaultBranchOnly + } + + $inputObject = @{ + Context = $Context + APIEndpoint = "/repos/$Owner/$Repo/forks" + Method = 'POST' + Body = $body + } + + if ($PSCmdlet.ShouldProcess("Repository [$Organization/$Name] as fork of [$Owner/$Repo]", 'Create')) { + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } + } catch { + throw $_ + } } - if ($PSCmdlet.ShouldProcess("Repository [$Organization/$Name] as fork of [$Owner/$Repo]", 'Create')) { - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response - } + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/private/Repositories/Repositories/Get-GitHubMyRepositories.ps1 b/src/functions/private/Repositories/Repositories/Get-GitHubMyRepositories.ps1 index 169fc58f..5b31eab4 100644 --- a/src/functions/private/Repositories/Repositories/Get-GitHubMyRepositories.ps1 +++ b/src/functions/private/Repositories/Repositories/Get-GitHubMyRepositories.ps1 @@ -113,34 +113,48 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - $body = @{ - type = $Type - sort = $Sort - direction = $Direction - per_page = $PerPage + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } - if ($PSBoundParameters.ContainsKey('Affiliation')) { - $body['affiliation'] = $Affiliation -join ',' - } - if ($PSBoundParameters.ContainsKey('Since')) { - $body['since'] = $Since.ToString('yyyy-MM-ddTHH:mm:ssZ') - } - if ($PSBoundParameters.ContainsKey('Before')) { - $body['before'] = $Before.ToString('yyyy-MM-ddTHH:mm:ssZ') - } - - $inputObject = @{ - Context = $Context - APIEndpoint = '/user/repos' - Method = 'GET' - body = $body + process { + try { + $body = @{ + type = $Type + sort = $Sort + direction = $Direction + per_page = $PerPage + } + + if ($PSBoundParameters.ContainsKey('Affiliation')) { + $body['affiliation'] = $Affiliation -join ',' + } + if ($PSBoundParameters.ContainsKey('Since')) { + $body['since'] = $Since.ToString('yyyy-MM-ddTHH:mm:ssZ') + } + if ($PSBoundParameters.ContainsKey('Before')) { + $body['before'] = $Before.ToString('yyyy-MM-ddTHH:mm:ssZ') + } + + $inputObject = @{ + Context = $Context + APIEndpoint = '/user/repos' + Method = 'GET' + body = $body + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + end { + Write-Debug "[$commandName] - End" } - } diff --git a/src/functions/private/Repositories/Repositories/Get-GitHubRepositoryByName.ps1 b/src/functions/private/Repositories/Repositories/Get-GitHubRepositoryByName.ps1 index 1d0f92d5..ec2fdaf8 100644 --- a/src/functions/private/Repositories/Repositories/Get-GitHubRepositoryByName.ps1 +++ b/src/functions/private/Repositories/Repositories/Get-GitHubRepositoryByName.ps1 @@ -36,26 +36,40 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo + } + Write-Debug "Repo : [$($Context.Repo)]" } - Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo - } - Write-Debug "Repo : [$($Context.Repo)]" + process { + try { - $inputObject = @{ - Context = $Context - APIEndpoint = "/repos/$Owner/$Repo" - Method = 'GET' - } + $inputObject = @{ + Context = $Context + APIEndpoint = "/repos/$Owner/$Repo" + Method = 'GET' + } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/private/Repositories/Repositories/Get-GitHubRepositoryListByID.ps1 b/src/functions/private/Repositories/Repositories/Get-GitHubRepositoryListByID.ps1 index c145124c..9de7f033 100644 --- a/src/functions/private/Repositories/Repositories/Get-GitHubRepositoryListByID.ps1 +++ b/src/functions/private/Repositories/Repositories/Get-GitHubRepositoryListByID.ps1 @@ -33,21 +33,35 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - $body = @{ - since = $Since + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } - $inputObject = @{ - Context = $Context - APIEndpoint = '/repositories' - Method = 'GET' - Body = $body - } + process { + try { + $body = @{ + since = $Since + } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + $inputObject = @{ + Context = $Context + APIEndpoint = '/repositories' + Method = 'GET' + Body = $body + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/private/Repositories/Repositories/Get-GitHubRepositoryListByOrg.ps1 b/src/functions/private/Repositories/Repositories/Get-GitHubRepositoryListByOrg.ps1 index e8ad3ed6..abdb2f8e 100644 --- a/src/functions/private/Repositories/Repositories/Get-GitHubRepositoryListByOrg.ps1 +++ b/src/functions/private/Repositories/Repositories/Get-GitHubRepositoryListByOrg.ps1 @@ -62,28 +62,42 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner - } - Write-Debug "Owner : [$($Context.Owner)]" - - $body = @{ - sort = $Sort - type = $Type - direction = $Direction - per_page = $PerPage + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" } - $inputObject = @{ - Context = $Context - APIEndpoint = "/orgs/$Owner/repos" - Method = 'GET' - Body = $body + process { + try { + $body = @{ + sort = $Sort + type = $Type + direction = $Direction + per_page = $PerPage + } + + $inputObject = @{ + Context = $Context + APIEndpoint = "/orgs/$Owner/repos" + Method = 'GET' + Body = $body + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/private/Repositories/Repositories/Get-GitHubRepositoryListByUser.ps1 b/src/functions/private/Repositories/Repositories/Get-GitHubRepositoryListByUser.ps1 index 3aa6a7e5..c03a934a 100644 --- a/src/functions/private/Repositories/Repositories/Get-GitHubRepositoryListByUser.ps1 +++ b/src/functions/private/Repositories/Repositories/Get-GitHubRepositoryListByUser.ps1 @@ -64,23 +64,47 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - $body = @{ - sort = $Sort - type = $Type - direction = $Direction - per_page = $PerPage + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" + + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo + } + Write-Debug "Repo : [$($Context.Repo)]" } - $inputObject = @{ - Context = $Context - APIEndpoint = "/users/$Username/repos" - Method = 'GET' - Body = $body + process { + try { + $body = @{ + sort = $Sort + type = $Type + direction = $Direction + per_page = $PerPage + } + + $inputObject = @{ + Context = $Context + APIEndpoint = "/users/$Username/repos" + Method = 'GET' + Body = $body + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/private/Repositories/Repositories/New-GitHubRepositoryFromTemplate.ps1 b/src/functions/private/Repositories/Repositories/New-GitHubRepositoryFromTemplate.ps1 index f58e8e89..133ee341 100644 --- a/src/functions/private/Repositories/Repositories/New-GitHubRepositoryFromTemplate.ps1 +++ b/src/functions/private/Repositories/Repositories/New-GitHubRepositoryFromTemplate.ps1 @@ -78,36 +78,45 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner - } - Write-Debug "Owner : [$($Context.Owner)]" - - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo - } - Write-Debug "Repo : [$($Context.Repo)]" - - $body = @{ - owner = $Owner - name = $Name - description = $Description - include_all_branches = $IncludeAllBranches - private = $Private + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" } - $inputObject = @{ - Context = $Context - APIEndpoint = "/repos/$TemplateOwner/$TemplateRepo/generate" - Method = 'POST' - Body = $body + process { + try { + $body = @{ + owner = $Owner + name = $Name + description = $Description + include_all_branches = $IncludeAllBranches + private = $Private + } + + $inputObject = @{ + Context = $Context + APIEndpoint = "/repos/$TemplateOwner/$TemplateRepo/generate" + Method = 'POST' + Body = $body + } + + if ($PSCmdlet.ShouldProcess("Repository [$Owner/$Name] from template [$TemplateOwner/$TemplateRepo]", 'Create')) { + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } + } catch { + throw $_ + } } - if ($PSCmdlet.ShouldProcess("Repository [$Owner/$Name] from template [$TemplateOwner/$TemplateRepo]", 'Create')) { - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response - } + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/private/Repositories/Repositories/New-GitHubRepositoryOrg.ps1 b/src/functions/private/Repositories/Repositories/New-GitHubRepositoryOrg.ps1 index f5366ca7..4990d1c4 100644 --- a/src/functions/private/Repositories/Repositories/New-GitHubRepositoryOrg.ps1 +++ b/src/functions/private/Repositories/Repositories/New-GitHubRepositoryOrg.ps1 @@ -212,7 +212,10 @@ filter New-GitHubRepositoryOrg { } begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT $GitignoreTemplate = $PSBoundParameters['GitignoreTemplate'] $LicenseTemplate = $PSBoundParameters['LicenseTemplate'] if ([string]::IsNullOrEmpty($Owner)) { @@ -222,50 +225,49 @@ filter New-GitHubRepositoryOrg { } process { - $PSCmdlet.MyInvocation.MyCommand.Parameters.GetEnumerator() | ForEach-Object { - $paramName = $_.Key - $paramDefaultValue = Get-Variable -Name $paramName -ValueOnly -ErrorAction SilentlyContinue - $providedValue = $PSBoundParameters[$paramName] - Write-Debug "[$paramName]" - Write-Debug " - Default: [$paramDefaultValue]" - Write-Debug " - Provided: [$providedValue]" - if (-not $PSBoundParameters.ContainsKey($paramName) -and ($null -ne $paramDefaultValue)) { - Write-Debug ' - Using default value' - $PSBoundParameters[$paramName] = $paramDefaultValue - } else { - Write-Debug ' - Using provided value' + try { + $body = @{ + name = $Name + description = $Description + homepage = $Homepage + visibility = $Visibility + has_issues = $HasIssues + has_projects = $HasProjects + has_wiki = $HasWiki + has_downloads = $HasDownloads + is_template = $IsTemplate + team_id = $TeamId + auto_init = $AutoInit + allow_squash_merge = $AllowSquashMerge + allow_merge_commit = $AllowMergeCommit + allow_rebase_merge = $AllowRebaseMerge + allow_auto_merge = $AllowAutoMerge + delete_branch_on_merge = $DeleteBranchOnMerge + squash_merge_commit_title = $SquashMergeCommitTitle + squash_merge_commit_message = $SquashMergeCommitMessage + merge_commit_title = $MergeCommitTitle + merge_commit_message = $MergeCommitMessage + private = $Visibility -eq 'private' } - } - $body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case - Remove-HashtableEntry -Hashtable $body -RemoveNames 'Owner' -RemoveTypes 'SwitchParameter' - - $body['private'] = $Visibility -eq 'private' - $body['has_issues'] = if ($HasIssues.IsPresent) { $HasIssues } else { $false } - $body['has_wiki'] = if ($HasWiki.IsPresent) { $HasWiki } else { $false } - $body['has_projects'] = if ($HasProjects.IsPresent) { $HasProjects } else { $false } - $body['has_downloads'] = if ($HasDownloads.IsPresent) { $HasDownloads } else { $false } - $body['is_template'] = if ($IsTemplate.IsPresent) { $IsTemplate } else { $false } - $body['auto_init'] = if ($AutoInit.IsPresent) { $AutoInit } else { $false } - $body['allow_squash_merge'] = if ($AllowSquashMerge.IsPresent) { $AllowSquashMerge } else { $false } - $body['allow_merge_commit'] = if ($AllowMergeCommit.IsPresent) { $AllowMergeCommit } else { $false } - $body['allow_rebase_merge'] = if ($AllowRebaseMerge.IsPresent) { $AllowRebaseMerge } else { $false } - $body['allow_auto_merge'] = if ($AllowAutoMerge.IsPresent) { $AllowAutoMerge } else { $false } - $body['delete_branch_on_merge'] = if ($DeleteBranchOnMerge.IsPresent) { $DeleteBranchOnMerge } else { $false } - - Remove-HashtableEntry -Hashtable $body -NullOrEmptyValues - - $inputObject = @{ - Context = $Context - APIEndpoint = "/orgs/$Owner/repos" - Method = 'POST' - Body = $body - } + $inputObject = @{ + Context = $Context + APIEndpoint = "/orgs/$Owner/repos" + Method = 'POST' + Body = $body + } - if ($PSCmdlet.ShouldProcess("Repository in organization $Owner", 'Create')) { - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + if ($PSCmdlet.ShouldProcess("Repository in organization $Owner", 'Create')) { + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } } + } catch { + throw $_ } } + + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/private/Repositories/Repositories/New-GitHubRepositoryUser.ps1 b/src/functions/private/Repositories/Repositories/New-GitHubRepositoryUser.ps1 index a8346ea2..1954e21a 100644 --- a/src/functions/private/Repositories/Repositories/New-GitHubRepositoryUser.ps1 +++ b/src/functions/private/Repositories/Repositories/New-GitHubRepositoryUser.ps1 @@ -206,57 +206,58 @@ filter New-GitHubRepositoryUser { } begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT $GitignoreTemplate = $PSBoundParameters['GitignoreTemplate'] $LicenseTemplate = $PSBoundParameters['LicenseTemplate'] } process { - - $PSCmdlet.MyInvocation.MyCommand.Parameters.GetEnumerator() | ForEach-Object { - $paramName = $_.Key - $paramDefaultValue = Get-Variable -Name $paramName -ValueOnly -ErrorAction SilentlyContinue - $providedValue = $PSBoundParameters[$paramName] - Write-Debug "[$paramName]" - Write-Debug " - Default: [$paramDefaultValue]" - Write-Debug " - Provided: [$providedValue]" - if (-not $PSBoundParameters.ContainsKey($paramName) -and ($null -ne $paramDefaultValue)) { - Write-Debug ' - Using default value' - $PSBoundParameters[$paramName] = $paramDefaultValue - } else { - Write-Debug ' - Using provided value' + try { + $body = @{ + name = $Name + description = $Description + homepage = $Homepage + visibility = $Visibility + has_issues = $HasIssues + has_projects = $HasProjects + has_wiki = $HasWiki + has_downloads = $HasDownloads + is_template = $IsTemplate + team_id = $TeamId + auto_init = $AutoInit + allow_squash_merge = $AllowSquashMerge + allow_merge_commit = $AllowMergeCommit + allow_rebase_merge = $AllowRebaseMerge + allow_auto_merge = $AllowAutoMerge + delete_branch_on_merge = $DeleteBranchOnMerge + squash_merge_commit_title = $SquashMergeCommitTitle + squash_merge_commit_message = $SquashMergeCommitMessage + merge_commit_title = $MergeCommitTitle + merge_commit_message = $MergeCommitMessage + private = $Visibility -eq 'private' } - } - $body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case - Remove-HashtableEntry -Hashtable $body -RemoveNames 'visibility' -RemoveTypes 'SwitchParameter' - - $body['private'] = $Visibility -eq 'private' - $body['has_issues'] = if ($HasIssues.IsPresent) { $HasIssues } else { $false } - $body['has_wiki'] = if ($HasWiki.IsPresent) { $HasWiki } else { $false } - $body['has_projects'] = if ($HasProjects.IsPresent) { $HasProjects } else { $false } - $body['has_downloads'] = if ($HasDownloads.IsPresent) { $HasDownloads } else { $false } - $body['is_template'] = if ($IsTemplate.IsPresent) { $IsTemplate } else { $false } - $body['auto_init'] = if ($AutoInit.IsPresent) { $AutoInit } else { $false } - $body['allow_squash_merge'] = if ($AllowSquashMerge.IsPresent) { $AllowSquashMerge } else { $false } - $body['allow_merge_commit'] = if ($AllowMergeCommit.IsPresent) { $AllowMergeCommit } else { $false } - $body['allow_rebase_merge'] = if ($AllowRebaseMerge.IsPresent) { $AllowRebaseMerge } else { $false } - $body['allow_auto_merge'] = if ($AllowAutoMerge.IsPresent) { $AllowAutoMerge } else { $false } - $body['delete_branch_on_merge'] = if ($DeleteBranchOnMerge.IsPresent) { $DeleteBranchOnMerge } else { $false } - - Remove-HashtableEntry -Hashtable $body -NullOrEmptyValues - - $inputObject = @{ - Context = $Context - APIEndpoint = '/user/repos' - Method = 'POST' - Body = $body - } + $inputObject = @{ + Context = $Context + APIEndpoint = '/user/repos' + Method = 'POST' + Body = $body + } - if ($PSCmdlet.ShouldProcess('Repository for user', 'Create')) { - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + if ($PSCmdlet.ShouldProcess('Repository for user', 'Create')) { + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } } + } catch { + throw $_ } } + + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/private/Users/Blocking/Block-GitHubUserByUser.ps1 b/src/functions/private/Users/Blocking/Block-GitHubUserByUser.ps1 index 1958b385..3c75e766 100644 --- a/src/functions/private/Users/Blocking/Block-GitHubUserByUser.ps1 +++ b/src/functions/private/Users/Blocking/Block-GitHubUserByUser.ps1 @@ -33,24 +33,35 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - $inputObject = @{ - Context = $Context - APIEndpoint = "/user/blocks/$Username" - Method = 'PUT' + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } - try { - $null = (Invoke-GitHubAPI @inputObject) - # Should we check if user is already blocked and return true if so? - return $true - } catch { - if ($_.Exception.Response.StatusCode.Value__ -eq 422) { - return $false - } else { - Write-Error $_.Exception.Response - throw $_ + process { + $inputObject = @{ + Context = $Context + APIEndpoint = "/user/blocks/$Username" + Method = 'PUT' + } + + try { + $null = (Invoke-GitHubAPI @inputObject) + # Should we check if user is already blocked and return true if so? + return $true + } catch { + if ($_.Exception.Response.StatusCode.Value__ -eq 422) { + return $false + } else { + Write-Error $_.Exception.Response + throw $_ + } } } + + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/private/Users/Blocking/Get-GitHubBlockedUserByUser.ps1 b/src/functions/private/Users/Blocking/Get-GitHubBlockedUserByUser.ps1 index 070070e3..5516d13a 100644 --- a/src/functions/private/Users/Blocking/Get-GitHubBlockedUserByUser.ps1 +++ b/src/functions/private/Users/Blocking/Get-GitHubBlockedUserByUser.ps1 @@ -28,21 +28,35 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - $body = @{ - per_page = $PerPage + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } - $inputObject = @{ - Context = $Context - APIEndpoint = '/user/blocks' - Method = 'GET' - Body = $body + process { + try { + $body = @{ + per_page = $PerPage + } + + $inputObject = @{ + Context = $Context + APIEndpoint = '/user/blocks' + Method = 'GET' + Body = $body + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + end { + Write-Debug "[$commandName] - End" } - } diff --git a/src/functions/private/Users/Blocking/Test-GitHubBlockedUserByUser.ps1 b/src/functions/private/Users/Blocking/Test-GitHubBlockedUserByUser.ps1 index d524f20c..c5cdaf37 100644 --- a/src/functions/private/Users/Blocking/Test-GitHubBlockedUserByUser.ps1 +++ b/src/functions/private/Users/Blocking/Test-GitHubBlockedUserByUser.ps1 @@ -40,27 +40,41 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - $body = @{ - per_page = $PerPage + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } - $inputObject = @{ - Context = $Context - APIEndpoint = "/user/blocks/$Username" - Method = 'GET' - Body = $body - } + process { + try { + $body = @{ + per_page = $PerPage + } - try { - (Invoke-GitHubAPI @inputObject).StatusCode -eq 204 - } catch { - if ($_.Exception.Response.StatusCode.Value__ -eq 404) { - return $false - } else { + $inputObject = @{ + Context = $Context + APIEndpoint = "/user/blocks/$Username" + Method = 'GET' + Body = $body + } + + try { + (Invoke-GitHubAPI @inputObject).StatusCode -eq 204 + } catch { + if ($_.Exception.Response.StatusCode.Value__ -eq 404) { + return $false + } else { + throw $_ + } + } + } catch { throw $_ } } + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/private/Users/Blocking/Unblock-GitHubUserByUser.ps1 b/src/functions/private/Users/Blocking/Unblock-GitHubUserByUser.ps1 index 55e11c29..169a3495 100644 --- a/src/functions/private/Users/Blocking/Unblock-GitHubUserByUser.ps1 +++ b/src/functions/private/Users/Blocking/Unblock-GitHubUserByUser.ps1 @@ -33,19 +33,34 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + } + + process { + try { + $inputObject = @{ + Context = $Context + APIEndpoint = "/user/blocks/$Username" + Method = 'DELETE' + } - $inputObject = @{ - Context = $Context - APIEndpoint = "/user/blocks/$Username" - Method = 'DELETE' + try { + $null = (Invoke-GitHubAPI @inputObject) + return $true + } catch { + Write-Error $_.Exception.Response + throw $_ + } + } catch { + throw $_ + } } - try { - $null = (Invoke-GitHubAPI @inputObject) - return $true - } catch { - Write-Error $_.Exception.Response - throw $_ + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/private/Users/Emails/Get-GitHubUserAllEmail.ps1 b/src/functions/private/Users/Emails/Get-GitHubUserAllEmail.ps1 index 3920bc53..b4457472 100644 --- a/src/functions/private/Users/Emails/Get-GitHubUserAllEmail.ps1 +++ b/src/functions/private/Users/Emails/Get-GitHubUserAllEmail.ps1 @@ -30,20 +30,34 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - $body = @{ - per_page = $PerPage - } - $inputObject = @{ - Context = $Context - APIEndpoint = '/user/emails' - Method = 'GET' - Body = $body + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + process { + try { + $body = @{ + per_page = $PerPage + } + $inputObject = @{ + Context = $Context + APIEndpoint = '/user/emails' + Method = 'GET' + Body = $body + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/private/Users/Emails/Get-GitHubUserPublicEmail.ps1 b/src/functions/private/Users/Emails/Get-GitHubUserPublicEmail.ps1 index 8c2deebf..f5f282ff 100644 --- a/src/functions/private/Users/Emails/Get-GitHubUserPublicEmail.ps1 +++ b/src/functions/private/Users/Emails/Get-GitHubUserPublicEmail.ps1 @@ -32,21 +32,35 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - $body = @{ - per_page = $PerPage + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } - $inputObject = @{ - Context = $Context - APIEndpoint = '/user/public_emails' - Method = 'GET' - Body = $body - } + process { + try { + $body = @{ + per_page = $PerPage + } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + $inputObject = @{ + Context = $Context + APIEndpoint = '/user/public_emails' + Method = 'GET' + Body = $body + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/private/Users/Followers/Get-GitHubUserFollowersOfUser.ps1 b/src/functions/private/Users/Followers/Get-GitHubUserFollowersOfUser.ps1 index dbf9efaa..305c9aab 100644 --- a/src/functions/private/Users/Followers/Get-GitHubUserFollowersOfUser.ps1 +++ b/src/functions/private/Users/Followers/Get-GitHubUserFollowersOfUser.ps1 @@ -38,21 +38,35 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - $body = @{ - per_page = $PerPage + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } - $inputObject = @{ - Context = $Context - APIEndpoint = "/users/$Username/followers" - Method = 'GET' - Body = $body - } + process { + try { + $body = @{ + per_page = $PerPage + } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + $inputObject = @{ + Context = $Context + APIEndpoint = "/users/$Username/followers" + Method = 'GET' + Body = $body + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/private/Users/Followers/Get-GitHubUserFollowingMe.ps1 b/src/functions/private/Users/Followers/Get-GitHubUserFollowingMe.ps1 index e229a5ad..362c1386 100644 --- a/src/functions/private/Users/Followers/Get-GitHubUserFollowingMe.ps1 +++ b/src/functions/private/Users/Followers/Get-GitHubUserFollowingMe.ps1 @@ -29,21 +29,35 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - $body = @{ - per_page = $PerPage + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } - $inputObject = @{ - Context = $Context - APIEndpoint = '/user/following' - Method = 'GET' - Body = $body + process { + try { + $body = @{ + per_page = $PerPage + } + + $inputObject = @{ + Context = $Context + APIEndpoint = '/user/following' + Method = 'GET' + Body = $body + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + end { + Write-Debug "[$commandName] - End" } - } diff --git a/src/functions/private/Users/Followers/Get-GitHubUserFollowingUser.ps1 b/src/functions/private/Users/Followers/Get-GitHubUserFollowingUser.ps1 index 66dff1aa..91aa7815 100644 --- a/src/functions/private/Users/Followers/Get-GitHubUserFollowingUser.ps1 +++ b/src/functions/private/Users/Followers/Get-GitHubUserFollowingUser.ps1 @@ -38,21 +38,35 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - $body = @{ - per_page = $PerPage + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } - $inputObject = @{ - Context = $Context - APIEndpoint = "/users/$Username/following" - Method = 'GET' - Body = $body - } + process { + try { + $body = @{ + per_page = $PerPage + } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + $inputObject = @{ + Context = $Context + APIEndpoint = "/users/$Username/following" + Method = 'GET' + Body = $body + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/private/Users/Followers/Get-GitHubUserMyFollowers.ps1 b/src/functions/private/Users/Followers/Get-GitHubUserMyFollowers.ps1 index e11bf920..8245c08d 100644 --- a/src/functions/private/Users/Followers/Get-GitHubUserMyFollowers.ps1 +++ b/src/functions/private/Users/Followers/Get-GitHubUserMyFollowers.ps1 @@ -30,21 +30,35 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - $body = @{ - per_page = $PerPage + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } - $inputObject = @{ - Context = $Context - APIEndpoint = '/user/followers' - Method = 'GET' - Body = $body - } + process { + try { + $body = @{ + per_page = $PerPage + } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + $inputObject = @{ + Context = $Context + APIEndpoint = '/user/followers' + Method = 'GET' + Body = $body + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/private/Users/Followers/Test-GitHubUserFollowedByMe.ps1 b/src/functions/private/Users/Followers/Test-GitHubUserFollowedByMe.ps1 index 2f3cf828..3a9a48a1 100644 --- a/src/functions/private/Users/Followers/Test-GitHubUserFollowedByMe.ps1 +++ b/src/functions/private/Users/Followers/Test-GitHubUserFollowedByMe.ps1 @@ -32,22 +32,33 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - $inputObject = @{ - Context = $Context - APIEndpoint = "/user/following/$Username" - Method = 'GET' + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } - try { - $null = (Invoke-GitHubAPI @inputObject) - return $true - } catch { - if ($_.Exception.Response.StatusCode.Value__ -eq 404) { - return $false - } else { - throw $_ + process { + $inputObject = @{ + Context = $Context + APIEndpoint = "/user/following/$Username" + Method = 'GET' + } + + try { + $null = (Invoke-GitHubAPI @inputObject) + return $true + } catch { + if ($_.Exception.Response.StatusCode.Value__ -eq 404) { + return $false + } else { + throw $_ + } } } + + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/private/Users/Followers/Test-GitHubUserFollowedByUser.ps1 b/src/functions/private/Users/Followers/Test-GitHubUserFollowedByUser.ps1 index 49bde7d9..81a84a88 100644 --- a/src/functions/private/Users/Followers/Test-GitHubUserFollowedByUser.ps1 +++ b/src/functions/private/Users/Followers/Test-GitHubUserFollowedByUser.ps1 @@ -38,22 +38,33 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - $inputObject = @{ - Context = $Context - APIEndpoint = "/users/$Username/following/$Follows" - Method = 'GET' + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } - try { - $null = (Invoke-GitHubAPI @inputObject) - return $true - } catch { - if ($_.Exception.Response.StatusCode.Value__ -eq 404) { - return $false - } else { - throw $_ + process { + $inputObject = @{ + Context = $Context + APIEndpoint = "/users/$Username/following/$Follows" + Method = 'GET' + } + + try { + $null = (Invoke-GitHubAPI @inputObject) + return $true + } catch { + if ($_.Exception.Response.StatusCode.Value__ -eq 404) { + return $false + } else { + throw $_ + } } } + + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/private/Users/GPG-Keys/Get-GitHubUserGpgKeyForUser.ps1 b/src/functions/private/Users/GPG-Keys/Get-GitHubUserGpgKeyForUser.ps1 index e137fb97..9dba33c4 100644 --- a/src/functions/private/Users/GPG-Keys/Get-GitHubUserGpgKeyForUser.ps1 +++ b/src/functions/private/Users/GPG-Keys/Get-GitHubUserGpgKeyForUser.ps1 @@ -36,21 +36,35 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - $body = @{ - per_page = $PerPage + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } - $inputObject = @{ - Context = $Context - APIEndpoint = "/users/$Username/gpg_keys" - Method = 'GET' - Body = $body - } + process { + try { + $body = @{ + per_page = $PerPage + } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + $inputObject = @{ + Context = $Context + APIEndpoint = "/users/$Username/gpg_keys" + Method = 'GET' + Body = $body + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/private/Users/GPG-Keys/Get-GitHubUserMyGpgKey.ps1 b/src/functions/private/Users/GPG-Keys/Get-GitHubUserMyGpgKey.ps1 index 45fdbe31..6f119bb6 100644 --- a/src/functions/private/Users/GPG-Keys/Get-GitHubUserMyGpgKey.ps1 +++ b/src/functions/private/Users/GPG-Keys/Get-GitHubUserMyGpgKey.ps1 @@ -31,21 +31,35 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - $body = @{ - per_page = $PerPage + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } - $inputObject = @{ - Context = $Context - APIEndpoint = '/user/gpg_keys' - Method = 'GET' - Body = $body - } + process { + try { + $body = @{ + per_page = $PerPage + } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + $inputObject = @{ + Context = $Context + APIEndpoint = '/user/gpg_keys' + Method = 'GET' + Body = $body + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/private/Users/GPG-Keys/Get-GitHubUserMyGpgKeyById.ps1 b/src/functions/private/Users/GPG-Keys/Get-GitHubUserMyGpgKeyById.ps1 index 5f88b848..14ba121f 100644 --- a/src/functions/private/Users/GPG-Keys/Get-GitHubUserMyGpgKeyById.ps1 +++ b/src/functions/private/Users/GPG-Keys/Get-GitHubUserMyGpgKeyById.ps1 @@ -33,16 +33,30 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - $inputObject = @{ - Context = $Context - APIEndpoint = "/user/gpg_keys/$ID" - Method = 'GET' + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + process { + try { + $inputObject = @{ + Context = $Context + APIEndpoint = "/user/gpg_keys/$ID" + Method = 'GET' + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/private/Users/Get-GitHubAllUser.ps1 b/src/functions/private/Users/Get-GitHubAllUser.ps1 index 45512ae1..c85e6284 100644 --- a/src/functions/private/Users/Get-GitHubAllUser.ps1 +++ b/src/functions/private/Users/Get-GitHubAllUser.ps1 @@ -36,22 +36,36 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - $body = @{ - since = $Since - per_page = $PerPage + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } - $inputObject = @{ - Context = $Context - APIEndpoint = '/users' - Method = 'GET' - Body = $body - } + process { + try { + $body = @{ + since = $Since + per_page = $PerPage + } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + $inputObject = @{ + Context = $Context + APIEndpoint = '/users' + Method = 'GET' + Body = $body + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/private/Users/Get-GitHubMyUser.ps1 b/src/functions/private/Users/Get-GitHubMyUser.ps1 index 31fca26d..9287be3f 100644 --- a/src/functions/private/Users/Get-GitHubMyUser.ps1 +++ b/src/functions/private/Users/Get-GitHubMyUser.ps1 @@ -26,16 +26,30 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - $inputObject = @{ - Context = $Context - APIEndpoint = '/user' - Method = 'GET' + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + process { + try { + $inputObject = @{ + Context = $Context + APIEndpoint = '/user' + Method = 'GET' + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/private/Users/Get-GitHubUserByName.ps1 b/src/functions/private/Users/Get-GitHubUserByName.ps1 index 23fbcf0a..4eda5148 100644 --- a/src/functions/private/Users/Get-GitHubUserByName.ps1 +++ b/src/functions/private/Users/Get-GitHubUserByName.ps1 @@ -44,16 +44,30 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - $inputObject = @{ - Context = $Context - APIEndpoint = "/users/$Username" - Method = 'GET' + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + process { + try { + $inputObject = @{ + Context = $Context + APIEndpoint = "/users/$Username" + Method = 'GET' + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/private/Users/Keys/Get-GitHubUserKeyForUser.ps1 b/src/functions/private/Users/Keys/Get-GitHubUserKeyForUser.ps1 index 387d0286..ba37c431 100644 --- a/src/functions/private/Users/Keys/Get-GitHubUserKeyForUser.ps1 +++ b/src/functions/private/Users/Keys/Get-GitHubUserKeyForUser.ps1 @@ -36,21 +36,35 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - $body = @{ - per_page = $PerPage + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } - $inputObject = @{ - Context = $Context - APIEndpoint = "/users/$Username/keys" - Method = 'GET' - Body = $body - } + process { + try { + $body = @{ + per_page = $PerPage + } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + $inputObject = @{ + Context = $Context + APIEndpoint = "/users/$Username/keys" + Method = 'GET' + Body = $body + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/private/Users/Keys/Get-GitHubUserMyKey.ps1 b/src/functions/private/Users/Keys/Get-GitHubUserMyKey.ps1 index 6ac7cc4f..4af14278 100644 --- a/src/functions/private/Users/Keys/Get-GitHubUserMyKey.ps1 +++ b/src/functions/private/Users/Keys/Get-GitHubUserMyKey.ps1 @@ -31,21 +31,35 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - $body = @{ - per_page = $PerPage + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } - $inputObject = @{ - Context = $Context - APIEndpoint = '/user/keys' - Method = 'GET' - Body = $body - } + process { + try { + $body = @{ + per_page = $PerPage + } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + $inputObject = @{ + Context = $Context + APIEndpoint = '/user/keys' + Method = 'GET' + Body = $body + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/private/Users/Keys/Get-GitHubUserMyKeyById.ps1 b/src/functions/private/Users/Keys/Get-GitHubUserMyKeyById.ps1 index 708366a6..38c66b58 100644 --- a/src/functions/private/Users/Keys/Get-GitHubUserMyKeyById.ps1 +++ b/src/functions/private/Users/Keys/Get-GitHubUserMyKeyById.ps1 @@ -33,16 +33,30 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - $inputObject = @{ - Context = $Context - APIEndpoint = "/user/keys/$ID" - Method = 'GET' + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + process { + try { + $inputObject = @{ + Context = $Context + APIEndpoint = "/user/keys/$ID" + Method = 'GET' + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/private/Users/SSH-Signing-Keys/Get-GitHubUserMySigningKey.ps1 b/src/functions/private/Users/SSH-Signing-Keys/Get-GitHubUserMySigningKey.ps1 index be19c95c..77d4120a 100644 --- a/src/functions/private/Users/SSH-Signing-Keys/Get-GitHubUserMySigningKey.ps1 +++ b/src/functions/private/Users/SSH-Signing-Keys/Get-GitHubUserMySigningKey.ps1 @@ -31,21 +31,35 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - $body = @{ - per_page = $PerPage + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } - $inputObject = @{ - Context = $Context - APIEndpoint = '/user/ssh_signing_keys' - Method = 'GET' - Body = $body - } + process { + try { + $body = @{ + per_page = $PerPage + } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + $inputObject = @{ + Context = $Context + APIEndpoint = '/user/ssh_signing_keys' + Method = 'GET' + Body = $body + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/private/Users/SSH-Signing-Keys/Get-GitHubUserMySigningKeyById.ps1 b/src/functions/private/Users/SSH-Signing-Keys/Get-GitHubUserMySigningKeyById.ps1 index 3fb5d79a..b95bca44 100644 --- a/src/functions/private/Users/SSH-Signing-Keys/Get-GitHubUserMySigningKeyById.ps1 +++ b/src/functions/private/Users/SSH-Signing-Keys/Get-GitHubUserMySigningKeyById.ps1 @@ -34,16 +34,30 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - $inputObject = @{ - Context = $Context - APIEndpoint = "/user/ssh_signing_keys/$ID" - Method = 'GET' + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + process { + try { + $inputObject = @{ + Context = $Context + APIEndpoint = "/user/ssh_signing_keys/$ID" + Method = 'GET' + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/private/Users/SSH-Signing-Keys/Get-GitHubUserSigningKeyForUser.ps1 b/src/functions/private/Users/SSH-Signing-Keys/Get-GitHubUserSigningKeyForUser.ps1 index 742388a2..4f577e54 100644 --- a/src/functions/private/Users/SSH-Signing-Keys/Get-GitHubUserSigningKeyForUser.ps1 +++ b/src/functions/private/Users/SSH-Signing-Keys/Get-GitHubUserSigningKeyForUser.ps1 @@ -36,21 +36,35 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - $body = @{ - per_page = $PerPage + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } - $inputObject = @{ - Context = $Context - APIEndpoint = "/users/$Username/ssh_signing_keys" - Method = 'GET' - Body = $body - } + process { + try { + $body = @{ + per_page = $PerPage + } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + $inputObject = @{ + Context = $Context + APIEndpoint = "/users/$Username/ssh_signing_keys" + Method = 'GET' + Body = $body + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/private/Users/Social-Accounts/Get-GitHubMyUserSocials.ps1 b/src/functions/private/Users/Social-Accounts/Get-GitHubMyUserSocials.ps1 index b888f2ae..aad55ccd 100644 --- a/src/functions/private/Users/Social-Accounts/Get-GitHubMyUserSocials.ps1 +++ b/src/functions/private/Users/Social-Accounts/Get-GitHubMyUserSocials.ps1 @@ -29,21 +29,35 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - $body = @{ - per_page = $PerPage + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } - $inputObject = @{ - Context = $Context - APIEndpoint = '/user/social_accounts' - Method = 'GET' - Body = $body + process { + try { + $body = @{ + per_page = $PerPage + } + + $inputObject = @{ + Context = $Context + APIEndpoint = '/user/social_accounts' + Method = 'GET' + Body = $body + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + end { + Write-Debug "[$commandName] - End" } - } diff --git a/src/functions/private/Users/Social-Accounts/Get-GitHubUserSocialsByName.ps1 b/src/functions/private/Users/Social-Accounts/Get-GitHubUserSocialsByName.ps1 index 9289d985..48a78c86 100644 --- a/src/functions/private/Users/Social-Accounts/Get-GitHubUserSocialsByName.ps1 +++ b/src/functions/private/Users/Social-Accounts/Get-GitHubUserSocialsByName.ps1 @@ -32,16 +32,30 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - $inputObject = @{ - Context = $Context - APIEndpoint = "/users/$Username/social_accounts" - Method = 'GET' + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + process { + try { + $inputObject = @{ + Context = $Context + APIEndpoint = "/users/$Username/social_accounts" + Method = 'GET' + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/public/Actions/Disable-GitHubWorkflow.ps1 b/src/functions/public/Actions/Disable-GitHubWorkflow.ps1 index 781d94c2..707afc2e 100644 --- a/src/functions/public/Actions/Disable-GitHubWorkflow.ps1 +++ b/src/functions/public/Actions/Disable-GitHubWorkflow.ps1 @@ -26,24 +26,37 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" + + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo + } + Write-Debug "Repo : [$($Context.Repo)]" } - Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo + process { + try { + $inputObject = @{ + Context = $Context + APIEndpoint = "/repos/$Owner/$Repo/actions/workflows/$ID/disable" + Method = 'PUT' + } + + $null = Invoke-GitHubAPI @inputObject + } catch { + throw $_ + } } - Write-Debug "Repo : [$($Context.Repo)]" - $inputObject = @{ - Context = $Context - APIEndpoint = "/repos/$Owner/$Repo/actions/workflows/$ID/disable" - Method = 'PUT' + end { + Write-Debug "[$commandName] - End" } - - $null = Invoke-GitHubAPI @inputObject - } diff --git a/src/functions/public/Actions/Enable-GitHubWorkflow.ps1 b/src/functions/public/Actions/Enable-GitHubWorkflow.ps1 index bea1ef5d..4d7fd43e 100644 --- a/src/functions/public/Actions/Enable-GitHubWorkflow.ps1 +++ b/src/functions/public/Actions/Enable-GitHubWorkflow.ps1 @@ -23,23 +23,37 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" + + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo + } + Write-Debug "Repo : [$($Context.Repo)]" } - Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo + process { + try { + $inputObject = @{ + Context = $Context + APIEndpoint = "/repos/$Owner/$Repo/actions/workflows/$ID/enable" + Method = 'PUT' + } + + $null = Invoke-GitHubAPI @inputObject + } catch { + throw $_ + } } - Write-Debug "Repo : [$($Context.Repo)]" - $inputObject = @{ - Context = $Context - APIEndpoint = "/repos/$Owner/$Repo/actions/workflows/$ID/enable" - Method = 'PUT' + end { + Write-Debug "[$commandName] - End" } - - $null = Invoke-GitHubAPI @inputObject } diff --git a/src/functions/public/Actions/Get-GitHubWorkflow.ps1 b/src/functions/public/Actions/Get-GitHubWorkflow.ps1 index 3c687390..9cc9cbb5 100644 --- a/src/functions/public/Actions/Get-GitHubWorkflow.ps1 +++ b/src/functions/public/Actions/Get-GitHubWorkflow.ps1 @@ -40,31 +40,44 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner - } - Write-Debug "Owner : [$($Context.Owner)]" - - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" + + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo + } + Write-Debug "Repo : [$($Context.Repo)]" } - Write-Debug "Repo : [$($Context.Repo)]" - $body = @{ - per_page = $PerPage + process { + try { + $body = @{ + per_page = $PerPage + } + + $inputObject = @{ + Context = $Context + APIEndpoint = "/repos/$Owner/$Repo/actions/workflows" + Method = 'GET' + Body = $body + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response.workflows + } + } catch { + throw $_ + } } - $inputObject = @{ - Context = $Context - APIEndpoint = "/repos/$Owner/$Repo/actions/workflows" - Method = 'GET' - Body = $body + end { + Write-Debug "[$commandName] - End" } - - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response.workflows - } - } diff --git a/src/functions/public/Actions/Get-GitHubWorkflowRun.ps1 b/src/functions/public/Actions/Get-GitHubWorkflowRun.ps1 index cfe456e5..6ab37f93 100644 --- a/src/functions/public/Actions/Get-GitHubWorkflowRun.ps1 +++ b/src/functions/public/Actions/Get-GitHubWorkflowRun.ps1 @@ -1,5 +1,6 @@ filter Get-GitHubWorkflowRun { <# + TODO:Split into two private functions and a swtich statement to handle the parameter set. .NOTES [List workflow runs for a workflow](https://docs.github.com/rest/actions/workflow-runs?apiVersion=2022-11-28#list-workflow-runs-for-a-workflow) [List workflow runs for a repository](https://docs.github.com/rest/actions/workflow-runs?apiVersion=2022-11-28#list-workflow-runs-for-a-repository) @@ -30,41 +31,54 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo + } + Write-Debug "Repo : [$($Context.Repo)]" } - Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo - } - Write-Debug "Repo : [$($Context.Repo)]" + process { + try { + $body = @{ + per_page = $PerPage + } - $body = @{ - per_page = $PerPage - } + if ($Name) { + $ID = (Get-GitHubWorkflow -Owner $Owner -Repo $Repo -Name $Name).id + } - if ($Name) { - $ID = (Get-GitHubWorkflow -Owner $Owner -Repo $Repo -Name $Name).id - } + if ($ID) { + $Uri = "/repos/$Owner/$Repo/actions/workflows/$ID/runs" + } else { + $Uri = "/repos/$Owner/$Repo/actions/runs" + } - if ($ID) { - $Uri = "/repos/$Owner/$Repo/actions/workflows/$ID/runs" - } else { - $Uri = "/repos/$Owner/$Repo/actions/runs" - } + $inputObject = @{ + Context = $Context + APIEndpoint = $Uri + Method = 'GET' + Body = $body + } - $inputObject = @{ - Context = $Context - APIEndpoint = $Uri - Method = 'GET' - Body = $body + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response.workflow_runs + } + } catch { + throw $_ + } } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response.workflow_runs + end { + Write-Debug "[$commandName] - End" } - } diff --git a/src/functions/public/Actions/Get-GitHubWorkflowUsage.ps1 b/src/functions/public/Actions/Get-GitHubWorkflowUsage.ps1 index 2749659e..96a6bd8f 100644 --- a/src/functions/public/Actions/Get-GitHubWorkflowUsage.ps1 +++ b/src/functions/public/Actions/Get-GitHubWorkflowUsage.ps1 @@ -34,26 +34,40 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo + } + Write-Debug "Repo : [$($Context.Repo)]" } - Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo - } - Write-Debug "Repo : [$($Context.Repo)]" + process { + try { - $inputObject = @{ - Context = $Context - Method = 'GET' - APIEndpoint = "/repos/$Owner/$Repo/actions/workflows/$ID/timing" - } + $inputObject = @{ + Context = $Context + Method = 'GET' + APIEndpoint = "/repos/$Owner/$Repo/actions/workflows/$ID/timing" + } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response.billable + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response.billable + } + } catch { + throw $_ + } } + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/public/Actions/Remove-GitHubWorkflowRun.ps1 b/src/functions/public/Actions/Remove-GitHubWorkflowRun.ps1 index b8909886..bb4336ae 100644 --- a/src/functions/public/Actions/Remove-GitHubWorkflowRun.ps1 +++ b/src/functions/public/Actions/Remove-GitHubWorkflowRun.ps1 @@ -40,28 +40,41 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner - } - Write-Debug "Owner : [$($Context.Owner)]" + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo + } + Write-Debug "Repo : [$($Context.Repo)]" } - Write-Debug "Repo : [$($Context.Repo)]" - $inputObject = @{ - Context = $Context - APIEndpoint = "repos/$Owner/$Repo/actions/runs/$RunID" - Method = 'DELETE' - } + process { + try { + $inputObject = @{ + Context = $Context + APIEndpoint = "repos/$Owner/$Repo/actions/runs/$RunID" + Method = 'DELETE' + } - if ($PSCmdlet.ShouldProcess("workflow run with ID [$RunID] in [$Owner/$Repo]", 'Delete')) { - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + if ($PSCmdlet.ShouldProcess("workflow run with ID [$RunID] in [$Owner/$Repo]", 'Delete')) { + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } + } catch { + throw $_ } } + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/public/Actions/Start-GitHubWorkflow.ps1 b/src/functions/public/Actions/Start-GitHubWorkflow.ps1 index 96dfe00f..1cf704e1 100644 --- a/src/functions/public/Actions/Start-GitHubWorkflow.ps1 +++ b/src/functions/public/Actions/Start-GitHubWorkflow.ps1 @@ -52,34 +52,47 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo + } + Write-Debug "Repo : [$($Context.Repo)]" } - Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo - } - Write-Debug "Repo : [$($Context.Repo)]" + process { + try { + $body = @{ + ref = $Ref + inputs = $Inputs + } - $body = @{ - ref = $Ref - inputs = $Inputs - } + $inputObject = @{ + Context = $Context + APIEndpoint = "/repos/$Owner/$Repo/actions/workflows/$ID/dispatches" + Method = 'POST' + Body = $body + } - $inputObject = @{ - Context = $Context - APIEndpoint = "/repos/$Owner/$Repo/actions/workflows/$ID/dispatches" - Method = 'POST' - Body = $body - } - - if ($PSCmdlet.ShouldProcess("workflow with ID [$ID] in [$Owner/$Repo]", 'Start')) { - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + if ($PSCmdlet.ShouldProcess("workflow with ID [$ID] in [$Owner/$Repo]", 'Start')) { + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } + } catch { + throw $_ } } + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/public/Actions/Start-GitHubWorkflowReRun.ps1 b/src/functions/public/Actions/Start-GitHubWorkflowReRun.ps1 index a5209b1b..7d2105e4 100644 --- a/src/functions/public/Actions/Start-GitHubWorkflowReRun.ps1 +++ b/src/functions/public/Actions/Start-GitHubWorkflowReRun.ps1 @@ -36,27 +36,41 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo + } + Write-Debug "Repo : [$($Context.Repo)]" } - Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo - } - Write-Debug "Repo : [$($Context.Repo)]" + process { + try { + $inputObject = @{ + Context = $Context + Method = 'POST' + APIEndpoint = "/repos/$Owner/$Repo/actions/runs/$ID/rerun" + } - $inputObject = @{ - Context = $Context - Method = 'POST' - APIEndpoint = "/repos/$Owner/$Repo/actions/runs/$ID/rerun" + if ($PSCmdlet.ShouldProcess("workflow with ID [$ID] in [$Owner/$Repo]", 'Re-run')) { + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } + } catch { + throw $_ + } } - if ($PSCmdlet.ShouldProcess("workflow with ID [$ID] in [$Owner/$Repo]", 'Re-run')) { - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response - } + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Actions/Stop-GitHubWorkflowRun.ps1 b/src/functions/public/Actions/Stop-GitHubWorkflowRun.ps1 index 2138de50..80bf356d 100644 --- a/src/functions/public/Actions/Stop-GitHubWorkflowRun.ps1 +++ b/src/functions/public/Actions/Stop-GitHubWorkflowRun.ps1 @@ -36,27 +36,41 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo + } + Write-Debug "Repo : [$($Context.Repo)]" } - Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo - } - Write-Debug "Repo : [$($Context.Repo)]" + process { + try { + $inputObject = @{ + Context = $Context + Method = 'POST' + APIEndpoint = "/repos/$Owner/$Repo/actions/runs/$ID/cancel" + } - $inputObject = @{ - Context = $Context - Method = 'POST' - APIEndpoint = "/repos/$Owner/$Repo/actions/runs/$ID/cancel" + if ($PSCmdlet.ShouldProcess("workflow run with ID [$ID] in [$Owner/$Repo]", 'Cancel/Stop')) { + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } + } catch { + throw $_ + } } - if ($PSCmdlet.ShouldProcess("workflow run with ID [$ID] in [$Owner/$Repo]", 'Cancel/Stop')) { - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response - } + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Apps/GitHub Apps/Get-GitHubApp.ps1 b/src/functions/public/Apps/GitHub Apps/Get-GitHubApp.ps1 index bbcd89b3..7c38e113 100644 --- a/src/functions/public/Apps/GitHub Apps/Get-GitHubApp.ps1 +++ b/src/functions/public/Apps/GitHub Apps/Get-GitHubApp.ps1 @@ -39,9 +39,6 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - Assert-GitHubContext -Context $Context -AuthType App - switch ($PSCmdlet.ParameterSetName) { 'BySlug' { Get-GitHubAppByName -AppSlug $AppSlug -Context $Context diff --git a/src/functions/public/Apps/GitHub Apps/Get-GitHubAppInstallation.ps1 b/src/functions/public/Apps/GitHub Apps/Get-GitHubAppInstallation.ps1 index fb8c1aef..4e9a9a86 100644 --- a/src/functions/public/Apps/GitHub Apps/Get-GitHubAppInstallation.ps1 +++ b/src/functions/public/Apps/GitHub Apps/Get-GitHubAppInstallation.ps1 @@ -25,16 +25,30 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - Assert-GitHubContext -Context $Context -AuthType App + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType APP + } - $inputObject = @{ - Context = $Context - APIEndpoint = '/app/installations' - Method = 'GET' + process { + try { + $inputObject = @{ + Context = $Context + APIEndpoint = '/app/installations' + Method = 'GET' + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Apps/GitHub Apps/New-GitHubAppInstallationAccessToken.ps1 b/src/functions/public/Apps/GitHub Apps/New-GitHubAppInstallationAccessToken.ps1 index 34bf8658..149706cf 100644 --- a/src/functions/public/Apps/GitHub Apps/New-GitHubAppInstallationAccessToken.ps1 +++ b/src/functions/public/Apps/GitHub Apps/New-GitHubAppInstallationAccessToken.ps1 @@ -65,21 +65,39 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - Assert-GitHubContext -Context $Context -AuthType App - - $inputObject = @{ - Context = $Context - APIEndpoint = "/app/installations/$InstallationID/access_tokens" - Method = 'Post' + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType APP } - Invoke-GitHubAPI @inputObject | ForEach-Object { - [pscustomobject]@{ - Token = $_.Response.token | ConvertTo-SecureString -AsPlainText -Force - ExpiresAt = $_.Response.expires_at.ToLocalTime() - Permissions = $_.Response.permissions - RepositorySelection = $_.Response.repository_selection + process { + try { + $inputObject = @{ + Context = $Context + APIEndpoint = "/app/installations/$InstallationID/access_tokens" + Method = 'Post' + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + [pscustomobject]@{ + Token = $_.Response.token | ConvertTo-SecureString -AsPlainText -Force + ExpiresAt = $_.Response.expires_at.ToLocalTime() + Permissions = $_.Response.permissions + RepositorySelection = $_.Response.repository_selection + } + } + } catch { + throw $_ } } + + end { + Write-Debug "[$commandName] - End" + } + + clean { + [System.GC]::Collect() + } } diff --git a/src/functions/public/Apps/Webhooks/Get-GitHubAppWebhookConfiguration.ps1 b/src/functions/public/Apps/Webhooks/Get-GitHubAppWebhookConfiguration.ps1 index 163b65fd..477d31ac 100644 --- a/src/functions/public/Apps/Webhooks/Get-GitHubAppWebhookConfiguration.ps1 +++ b/src/functions/public/Apps/Webhooks/Get-GitHubAppWebhookConfiguration.ps1 @@ -26,16 +26,31 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - Assert-GitHubContext -Context $Context -AuthType App + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType APP + } - $inputObject = @{ - Context = $Context - APIEndpoint = '/app/hook/config' - Method = 'GET' + process { + try { + $inputObject = @{ + Context = $Context + APIEndpoint = '/app/hook/config' + Method = 'GET' + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + end { + Write-Debug "[$commandName] - End" } } + diff --git a/src/functions/public/Apps/Webhooks/Get-GitHubAppWebhookDelivery.ps1 b/src/functions/public/Apps/Webhooks/Get-GitHubAppWebhookDelivery.ps1 index e5a25609..14ff6896 100644 --- a/src/functions/public/Apps/Webhooks/Get-GitHubAppWebhookDelivery.ps1 +++ b/src/functions/public/Apps/Webhooks/Get-GitHubAppWebhookDelivery.ps1 @@ -25,16 +25,30 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - Assert-GitHubContext -Context $Context -AuthType App + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType APP + } - $inputObject = @{ - Context = $Context - APIEndpoint = '/app/hook/deliveries' - Method = 'GET' + process { + try { + $inputObject = @{ + Context = $Context + APIEndpoint = '/app/hook/deliveries' + Method = 'GET' + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Auth/Context/Get-GitHubContext.ps1 b/src/functions/public/Auth/Context/Get-GitHubContext.ps1 index ef228537..3d07d8f7 100644 --- a/src/functions/public/Auth/Context/Get-GitHubContext.ps1 +++ b/src/functions/public/Auth/Context/Get-GitHubContext.ps1 @@ -43,7 +43,6 @@ function Get-GitHubContext { } process { - switch ($PSCmdlet.ParameterSetName) { 'NamedContext' { Write-Verbose "NamedContext: [$Context]" From dc897a5aa9d99e65a41a012bfd53b96bb690726b Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sun, 15 Dec 2024 10:57:37 +0100 Subject: [PATCH 02/24] Add `Get-GitHubWorkflowRunByRepo` cmdlet to list workflow runs for a repository --- .../Actions/Get-GitHubWorkflowRunByRepo.ps1 | 138 +++++++++++++++++ .../Get-GitHubWorkflowRunByWorkflow.ps1 | 145 ++++++++++++++++++ .../public/Actions/Get-GitHubWorkflowRun.ps1 | 140 +++++++++++++---- 3 files changed, 397 insertions(+), 26 deletions(-) create mode 100644 src/functions/private/Actions/Get-GitHubWorkflowRunByRepo.ps1 create mode 100644 src/functions/private/Actions/Get-GitHubWorkflowRunByWorkflow.ps1 diff --git a/src/functions/private/Actions/Get-GitHubWorkflowRunByRepo.ps1 b/src/functions/private/Actions/Get-GitHubWorkflowRunByRepo.ps1 new file mode 100644 index 00000000..ec6b9548 --- /dev/null +++ b/src/functions/private/Actions/Get-GitHubWorkflowRunByRepo.ps1 @@ -0,0 +1,138 @@ +filter Get-GitHubWorkflowRunByRepo { + <# + .SYNOPSIS + List workflow runs for a repository + + .DESCRIPTION + Lists all workflow runs for a repository. You can use parameters to narrow the list of results. For more information about using parameters, + see [Parameters](https://docs.github.com/rest/guides/getting-started-with-the-rest-api#parameters). + Anyone with read access to the repository can use this endpoint. + OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint with a private repository. + This endpoint will return up to 1,000 results for each search when using the following parameters: `actor`, `branch`, `check_suite_id`, + `created`, `event`, `head_sha`, `status`. + + .EXAMPLE + Get-GitHubWorkflowRunByRepo -Owner 'owner' -Repo 'repo' + + Lists all workflow runs for a repository. + + .EXAMPLE + Get-GitHubWorkflowRunByRepo -Owner 'owner' -Repo 'repo' -Actor 'octocat' -Branch 'main' -Event 'push' -Status 'success' + + Lists all workflow runs for a repository with the specified actor, branch, event, and status. + + .NOTES + [List workflow runs for a repository](https://docs.github.com/rest/actions/workflow-runs?apiVersion=2022-11-28#list-workflow-runs-for-a-repository) + #> + [CmdletBinding(DefaultParameterSetName = 'Repo')] + [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidLongLines', '', Justification = 'Contains a long link.')] + [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidAssignmentToAutomaticVariable', 'Event', + Justification = 'A parameter that is used in the api call.')] + param( + # The account owner of the repository. The name is not case sensitive. + [Parameter(Mandatory)] + [string] $Owner, + + # The name of the repository. The name is not case sensitive. + [Parameter(Mandatory)] + [string] $Repo, + + # Returns someone's workflow runs. Use the login for the user who created the push associated with the check suite or workflow run. + [Parameter()] + [string] $Actor, + + # Returns workflow runs associated with a branch. Use the name of the branch of the `push`. + [Parameter()] + [string] $Branch, + + # Returns workflow run triggered by the event you specify. For example, `push`, `pull_request` or `issue`. For more information, see + # "[Events that trigger workflows])(https://docs.github.com/actions/automating-your-workflow-with-github-actions/events-that-trigger-workflows)." + [Parameter()] + [string] $Event, + + # Returns workflow runs with the check run status or conclusion that you specify. For example, a conclusion can be success or a status can be + # `in_progress`. Only GitHub Actions can set a status of `waiting`, `pending`, or `requested`. + # Can be one of: `completed`, `action_required`, `cancelled`, `failure`, `neutral`, `skipped`, `stale`, `success`, `timed_out`, `in_progress`, + # `queued`, `requested`, `waiting`, `pending`. + [Parameter()] + [ValidateSet('completed', 'action_required', 'cancelled', 'failure', 'neutral', 'skipped', 'stale', 'success', 'timed_out', 'in_progress', + 'queued', 'requested', 'waiting', 'pending')] + [string] $Status, + + # Returns workflow runs created within the given date-time range. For more information on the syntax, see + # "[Understanding the search syntax](https://docs.github.com/search-github/getting-started-with-searching-on-github/understanding-the-search-syntax#query-for-dates)." + [Parameter()] + [datetime] $Created, + + # If `true` pull requests are omitted from the response (empty array). + [Parameter()] + [switch] $ExcludePullRequests, + + # Returns workflow runs with the check_suite_id that you specify. + [Parameter()] + [int] $CheckSuiteID, + + # Only returns workflow runs that are associated with the specified head_sha. + [Parameter()] + [string] $HeadSHA, + + # The number of results per page (max 100). + [Parameter()] + [ValidateRange(0, 100)] + [int] $PerPage, + + # 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 { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" + + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo + } + Write-Debug "Repo : [$($Context.Repo)]" + } + + process { + try { + $body = @{ + actor = $Actor + branch = $Branch + event = $Event + status = $Status + created = $Created + exclude_pull_requests = $ExcludePullRequests + check_suite_id = $CheckSuiteID + head_sha = $HeadSHA + per_page = $PerPage + } + + $inputObject = @{ + Context = $Context + APIEndpoint = "/repos/$Owner/$Repo/actions/runs" + Method = 'GET' + Body = $body + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response.workflow_runs + } + } catch { + throw $_ + } + } + + end { + Write-Debug "[$commandName] - End" + } +} diff --git a/src/functions/private/Actions/Get-GitHubWorkflowRunByWorkflow.ps1 b/src/functions/private/Actions/Get-GitHubWorkflowRunByWorkflow.ps1 new file mode 100644 index 00000000..9a5647ce --- /dev/null +++ b/src/functions/private/Actions/Get-GitHubWorkflowRunByWorkflow.ps1 @@ -0,0 +1,145 @@ +filter Get-GitHubWorkflowRunByWorkflow { + <# + .SYNOPSIS + List workflow runs for a workflow + + .DESCRIPTION + List all workflow runs for a workflow. You can replace `workflow_id` with the workflow file name. For example, you could use `main.yaml`. + You can use parameters to narrow the list of results. For more information about using parameters, see + [Parameters](https://docs.github.com/rest/guides/getting-started-with-the-rest-api#parameters). + Anyone with read access to the repository can use this endpoint + OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint with a private repository. + This endpoint will return up to 1,000 results for each search when using the following parameters: `actor`, `branch`, `check_suite_id`, + `created`, `event`, `head_sha`, `status`. + + .EXAMPLE + Get-GitHubWorkflowRunByWorkflow -Owner 'octocat' -Repo 'Hello-World' -ID '42' + + Gets all workflow runs for the workflow with the ID `42` in the repository `Hello-World` owned by `octocat`. + + .EXAMPLE + Get-GitHubWorkflowRunByWorkflow -Owner 'octocat' -Repo 'Hello-World' -ID '42' -Actor 'octocat' -Branch 'main' -Event 'push' -Status 'success' + + Gets all workflow runs for the workflow with the ID `42` in the repository `Hello-World` owned by `octocat` that were triggered by the user + `octocat` on the branch `main` and have the status `success`. + + .NOTES + [List workflow runs for a workflow](https://docs.github.com/rest/actions/workflow-runs?apiVersion=2022-11-28#list-workflow-runs-for-a-workflow) + #> + [CmdletBinding(DefaultParameterSetName = 'Repo')] + [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidLongLines', '', Justification = 'Contains a long link.')] + [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidAssignmentToAutomaticVariable', 'Event', + Justification = 'A parameter that is used in the api call.')] + param( + # The account owner of the repository. The name is not case sensitive. + [Parameter(Mandatory)] + [string] $Owner, + + # The name of the repository. The name is not case sensitive. + [Parameter(Mandatory)] + [string] $Repo, + + # The ID of the workflow. You can also pass the workflow file name as a string. + [Parameter(Mandatory)] + [Alias('workflow_id', 'WorkflowID')] + [string] $ID, + + # Returns someone's workflow runs. Use the login for the user who created the push associated with the check suite or workflow run. + [Parameter()] + [string] $Actor, + + # Returns workflow runs associated with a branch. Use the name of the branch of the `push`. + [Parameter()] + [string] $Branch, + + # Returns workflow run triggered by the event you specify. For example, `push`, `pull_request` or `issue`. For more information, see + # "[Events that trigger workflows])(https://docs.github.com/actions/automating-your-workflow-with-github-actions/events-that-trigger-workflows)." + [Parameter()] + [string] $Event, + + # Returns workflow runs with the check run status or conclusion that you specify. For example, a conclusion can be success or a status can be + # `in_progress`. Only GitHub Actions can set a status of `waiting`, `pending`, or `requested`. + # Can be one of: `completed`, `action_required`, `cancelled`, `failure`, `neutral`, `skipped`, `stale`, `success`, `timed_out`, `in_progress`, + # `queued`, `requested`, `waiting`, `pending`. + [Parameter()] + [ValidateSet('completed', 'action_required', 'cancelled', 'failure', 'neutral', 'skipped', 'stale', 'success', 'timed_out', 'in_progress', + 'queued', 'requested', 'waiting', 'pending')] + [string] $Status, + + # Returns workflow runs created within the given date-time range. For more information on the syntax, see + # "[Understanding the search syntax](https://docs.github.com/search-github/getting-started-with-searching-on-github/understanding-the-search-syntax#query-for-dates)." + [Parameter()] + [datetime] $Created, + + # If `true` pull requests are omitted from the response (empty array). + [Parameter()] + [switch] $ExcludePullRequests, + + # Returns workflow runs with the check_suite_id that you specify. + [Parameter()] + [int] $CheckSuiteID, + + # Only returns workflow runs that are associated with the specified head_sha. + [Parameter()] + [string] $HeadSHA, + + # The number of results per page (max 100). + [Parameter()] + [ValidateRange(0, 100)] + [int] $PerPage, + + # 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 { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" + + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo + } + Write-Debug "Repo : [$($Context.Repo)]" + } + + process { + try { + $body = @{ + actor = $Actor + branch = $Branch + event = $Event + status = $Status + created = $Created + exclude_pull_requests = $ExcludePullRequests + check_suite_id = $CheckSuiteID + head_sha = $HeadSHA + per_page = $PerPage + } + + $inputObject = @{ + Context = $Context + APIEndpoint = "/repos/$Owner/$Repo/actions/workflows/$ID/runs" + Method = 'GET' + Body = $body + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response.workflow_runs + } + } catch { + throw $_ + } + } + + end { + Write-Debug "[$commandName] - End" + } +} diff --git a/src/functions/public/Actions/Get-GitHubWorkflowRun.ps1 b/src/functions/public/Actions/Get-GitHubWorkflowRun.ps1 index 6ab37f93..48c645c7 100644 --- a/src/functions/public/Actions/Get-GitHubWorkflowRun.ps1 +++ b/src/functions/public/Actions/Get-GitHubWorkflowRun.ps1 @@ -1,24 +1,107 @@ filter Get-GitHubWorkflowRun { <# - TODO:Split into two private functions and a swtich statement to handle the parameter set. + .SYNOPSIS + List workflow runs for a repository or a workflow + + .DESCRIPTION + Lists all workflow runs for a repository or a workflow. You can use parameters to narrow the list of results. For more information about using + parameters, see [Parameters](https://docs.github.com/rest/guides/getting-started-with-the-rest-api#parameters). + Anyone with read access to the repository can use this endpoint. + OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint with a private repository. + This endpoint will return up to 1,000 results for each search when using the following parameters: `actor`, `branch`, `check_suite_id`, `created`, + `event`, `head_sha`, `status`. + + .EXAMPLE + Get-GitHubWorkflowRun -Owner 'owner' -Repo 'repo' + + Lists all workflow runs for a repository. + + .EXAMPLE + Get-GitHubWorkflowRun -Owner 'owner' -Repo 'repo' -Actor 'octocat' -Branch 'main' -Event 'push' -Status 'success' + + Lists all workflow runs for a repository with the specified actor, branch, event, and status. + + .EXAMPLE + Get-GitHubWorkflowRun -Owner 'octocat' -Repo 'Hello-World' -ID '42' + + Gets all workflow runs for the workflow with the ID `42` in the repository `Hello-World` owned by `octocat`. + + .EXAMPLE + Get-GitHubWorkflowRun -Owner 'octocat' -Repo 'Hello-World' -Name 'nightly.yml' -Actor 'octocat' -Branch 'main' -Event 'push' -Status 'success' + + Gets all workflow runs for the workflow with the name `nightly.yml` in the repository `Hello-World` owned by `octocat` that were triggered by + the user `octocat` on the branch `main` and have the status `success`. + .NOTES [List workflow runs for a workflow](https://docs.github.com/rest/actions/workflow-runs?apiVersion=2022-11-28#list-workflow-runs-for-a-workflow) [List workflow runs for a repository](https://docs.github.com/rest/actions/workflow-runs?apiVersion=2022-11-28#list-workflow-runs-for-a-repository) #> - [CmdletBinding(DefaultParameterSetName = 'Repo')] + [CmdletBinding(DefaultParameterSetName = '__AllParameterSets')] [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidLongLines', '', Justification = 'Contains a long link.')] + [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidAssignmentToAutomaticVariable', 'Event', + Justification = 'A parameter that is used in the api call.')] param( - [Parameter()] + # The account owner of the repository. The name is not case sensitive. + [Parameter(Mandatory)] [string] $Owner, - [Parameter()] + # The name of the repository. The name is not case sensitive. + [Parameter(Mandatory)] [string] $Repo, - [Parameter(ParameterSetName = 'ByName')] + # The ID of the workflow. You can also pass the workflow file name as a string. + [Parameter( + Mandatory, + ParameterSetName = 'ByID' + )] + [Alias('workflow_id', 'WorkflowID')] + [string] $ID, + + # The name of the workflow. + [Parameter( + Mandatory, + ParameterSetName = 'ByName' + )] [string] $Name, - [Parameter(ParameterSetName = 'ByID')] - [string] $ID, + # Returns someone's workflow runs. Use the login for the user who created the push associated with the check suite or workflow run. + [Parameter()] + [string] $Actor, + + # Returns workflow runs associated with a branch. Use the name of the branch of the `push`. + [Parameter()] + [string] $Branch, + + # Returns workflow run triggered by the event you specify. For example, `push`, `pull_request` or `issue`. For more information, see + # "[Events that trigger workflows])(https://docs.github.com/actions/automating-your-workflow-with-github-actions/events-that-trigger-workflows)." + [Parameter()] + [string] $Event, + + # Returns workflow runs with the check run status or conclusion that you specify. For example, a conclusion can be success or a status can be + # `in_progress`. Only GitHub Actions can set a status of `waiting`, `pending`, or `requested`. + # Can be one of: `completed`, `action_required`, `cancelled`, `failure`, `neutral`, `skipped`, `stale`, `success`, `timed_out`, `in_progress`, + # `queued`, `requested`, `waiting`, `pending`. + [Parameter()] + [ValidateSet('completed', 'action_required', 'cancelled', 'failure', 'neutral', 'skipped', 'stale', 'success', 'timed_out', 'in_progress', + 'queued', 'requested', 'waiting', 'pending')] + [string] $Status, + + # Returns workflow runs created within the given date-time range. For more information on the syntax, see + # "[Understanding the search syntax](https://docs.github.com/search-github/getting-started-with-searching-on-github/understanding-the-search-syntax#query-for-dates)." + [Parameter()] + [datetime] $Created, + + # If `true` pull requests are omitted from the response (empty array). + [Parameter()] + [switch] $ExcludePullRequests, + + # Returns workflow runs with the check_suite_id that you specify. + [Parameter()] + [int] $CheckSuiteID, + + # Only returns workflow runs that are associated with the specified head_sha. + [Parameter()] + [string] $HeadSHA, # The number of results per page (max 100). [Parameter()] @@ -49,29 +132,34 @@ process { try { - $body = @{ - per_page = $PerPage + $params = @{ + Owner = $Owner + Repo = $Repo + Actor = $Actor + Branch = $Branch + Event = $Event + Status = $Status + Created = $Created + ExcludePullRequests = $ExcludePullRequests + CheckSuiteID = $CheckSuiteID + HeadSHA = $HeadSHA + PerPage = $PerPage } - if ($Name) { - $ID = (Get-GitHubWorkflow -Owner $Owner -Repo $Repo -Name $Name).id - } - - if ($ID) { - $Uri = "/repos/$Owner/$Repo/actions/workflows/$ID/runs" - } else { - $Uri = "/repos/$Owner/$Repo/actions/runs" - } + switch ($PSCmdlet.ParameterSetName) { + 'ByID' { + $params['ID'] = $ID + Get-GitHubWorkflowRunByWorkflow @params + } - $inputObject = @{ - Context = $Context - APIEndpoint = $Uri - Method = 'GET' - Body = $body - } + 'ByName' { + $params['ID'] = (Get-GitHubWorkflow -Owner $Owner -Repo $Repo -Name $Name).id + Get-GitHubWorkflowRunByWorkflow @params + } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response.workflow_runs + '__AllParameterSets' { + Get-GitHubWorkflowRunByRepo @params + } } } catch { throw $_ From 098704079e7481bdf79a71681faad1a257d97f25 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sun, 15 Dec 2024 10:57:42 +0100 Subject: [PATCH 03/24] Refactor GitHub API functions to standardize path and method usage; add New-FunctionTemplate for function creation --- tools/utilities/GitHubAPI.ps1 | 60 ++---------- tools/utilities/New-Function.ps1 | 115 ++++++++++------------- tools/utilities/New-FunctionTemplate.ps1 | 85 +++++++++++++++++ 3 files changed, 142 insertions(+), 118 deletions(-) create mode 100644 tools/utilities/New-FunctionTemplate.ps1 diff --git a/tools/utilities/GitHubAPI.ps1 b/tools/utilities/GitHubAPI.ps1 index e7a06f98..05baf5dd 100644 --- a/tools/utilities/GitHubAPI.ps1 +++ b/tools/utilities/GitHubAPI.ps1 @@ -21,8 +21,8 @@ $response = Invoke-RestMethod -Uri $APIDocURI -Method Get # @{n = 'PUT'; e = { (($_.value.psobject.Properties.Name) -contains 'PUT') } }, ` # @{n = 'PATCH'; e = { (($_.value.psobject.Properties.Name) -contains 'PATCH') } } | Format-Table -$path = '/apps/{app_slug}' -$method = 'get' +$path = '/repos/{owner}/{repo}/actions/runs' +$method = 'GET' $response.paths.$path.$method $response.paths.$path.$method.tags | clip # -> Namespace/foldername $response.paths.$path.$method.operationId | clip # -> FunctionName @@ -41,57 +41,9 @@ $response.paths.$path.$method.responses.'200'.content.'application/json'.schema $response.paths.$path.$method.responses.'200'.content.'application/json'.schema.items # -> OutputType $response.components.schemas.'issue-comment' | ConvertTo-Json +$response.components.responses # HTTP status descriptions -function New-Function { - [CmdletBinding(SupportsShouldProcess)] - param( - [Parameter(Mandatory)] - [string] $Path, - - [Parameter(Mandatory)] - [string] $Method - ) - - $APIDocURI = 'https://raw.githubusercontent.com/github/rest-api-description/main' - $Bundled = '/descriptions/api.github.com/api.github.com.json' - # $Dereferenced = 'descriptions/api.github.com/dereferenced/api.github.com.deref.json' - $APIDocURI = $APIDocURI + $Bundled - $response = Invoke-RestMethod -Uri $APIDocURI -Method Get - - $response.paths.$Path.$Method - - $FunctionName = "$Method-GitHub" + (($response.paths.$path.$method.operationId) -Replace '/', '-') - - $folderName = $response.paths.$path.$method.'x-github'.category - $subFolderName = $response.paths.$path.$method.'x-github'.subcategory - - $template = @" - function $FunctionName { - <# - .SYNOPSIS - $($response.paths.$path.$method.summary) - - .DESCRIPTION - $($response.paths.$path.$method.description) - - .EXAMPLE - An example - - .NOTES - [$($response.paths.$path.$method.summary)]($($response.paths.$path.$method.externalDocs.url)) - #> - [OutputType([pscustomobject])] - [CmdletBinding()] - param( - # The context to run the command in. - [Parameter()] - [string] `$Context = (Get-GitHubConfig -Name 'DefaultContext') - ) - } -"@ - if ($PSCmdlet.ShouldProcess('Function', 'Create')) { - New-Item -Path "src/functions/$folderName/$subFolderName" -Name "$FunctionName.ps1" -ItemType File -Value $template - } - -} +$path = '/repos/{owner}/{repo}/actions/runs' +$method = 'get' +$response.components.schemas.'issue-comment' diff --git a/tools/utilities/New-Function.ps1 b/tools/utilities/New-Function.ps1 index 062e987e..e7a79fde 100644 --- a/tools/utilities/New-Function.ps1 +++ b/tools/utilities/New-Function.ps1 @@ -1,85 +1,72 @@ -function New-Function { + +function New-Function { <# - .SYNOPSIS - Short description + .SYNOPSIS + Short description - .DESCRIPTION - Long description + .DESCRIPTION + Long description - .EXAMPLE - An example + .PARAMETER Path + Parameter description - .NOTES - General notes + .PARAMETER Method + Parameter description + + .EXAMPLE + An example + + .NOTES + General notes #> [CmdletBinding(SupportsShouldProcess)] param( - # The name of the organization. - [Parameter()] - [string]$Owner, - - # The name of the organization. - [Parameter()] - [string]$Repo, + [Parameter(Mandatory)] + [string] $Path, - # 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) + [Parameter(Mandatory)] + [string] $Method ) - begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $APIDocURI = 'https://raw.githubusercontent.com/github/rest-api-description/main' + $Bundled = '/descriptions/api.github.com/api.github.com.json' + # $Dereferenced = 'descriptions/api.github.com/dereferenced/api.github.com.deref.json' + $APIDocURI = $APIDocURI + $Bundled + $response = Invoke-RestMethod -Uri $APIDocURI -Method Get - $Context = Resolve-GitHubContext -Context $Context + $response.paths.$Path.$Method - if ([string]::IsNullOrEmpty($Enterprise)) { - $Enterprise = $Context.Enterprise - } - Write-Debug "Enterprise : [$($Context.Enterprise)]" + $FunctionName = "$Method-GitHub" + (($response.paths.$path.$method.operationId) -Replace '/', '-') - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner - } - Write-Debug "Owner : [$($Context.Owner)]" + $folderName = $response.paths.$path.$method.'x-github'.category + $subFolderName = $response.paths.$path.$method.'x-github'.subcategory - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo - } - Write-Debug "Repo : [$($Context.Repo)]" - } + $template = @" + function $FunctionName { + <# + .SYNOPSIS + $($response.paths.$path.$method.summary) - process { - try { - $body = @{ - per_page = $PerPage - } + .DESCRIPTION + $($response.paths.$path.$method.description) - $inputObject = @{ - Context = $Context - APIEndpoint = "/orgs/$OrganizationName/blocks" - Method = 'GET' - Body = $body - } + .EXAMPLE + An example - if ($PSCmdlet.ShouldProcess('Target', 'Operation')) { - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response - } - } - } catch { - Write-Debug "Error: $_" - } finally { - Write-Debug 'Finally' - } + .NOTES + [$($response.paths.$path.$method.summary)]($($response.paths.$path.$method.externalDocs.url)) + #> + [OutputType([pscustomobject])] + [CmdletBinding()] + param( + # The context to run the command in. + [Parameter()] + [string] `$Context = (Get-GitHubConfig -Name 'DefaultContext') + ) } - - end { - Write-Debug "[$commandName] - End" +"@ + if ($PSCmdlet.ShouldProcess('Function', 'Create')) { + New-Item -Path "src/functions/$folderName/$subFolderName" -Name "$FunctionName.ps1" -ItemType File -Value $template } - clean { - Write-Debug 'Clean' - } } diff --git a/tools/utilities/New-FunctionTemplate.ps1 b/tools/utilities/New-FunctionTemplate.ps1 new file mode 100644 index 00000000..4d025022 --- /dev/null +++ b/tools/utilities/New-FunctionTemplate.ps1 @@ -0,0 +1,85 @@ +function New-FunctionTemplate { + <# + .SYNOPSIS + Short description + + .DESCRIPTION + Long description + + .EXAMPLE + An example + + .NOTES + General notes + #> + [CmdletBinding(SupportsShouldProcess)] + param( + # The name of the organization. + [Parameter()] + [string]$Owner, + + # The name of the organization. + [Parameter()] + [string]$Repo, + + # 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 { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + + $Context = Resolve-GitHubContext -Context $Context + + if ([string]::IsNullOrEmpty($Enterprise)) { + $Enterprise = $Context.Enterprise + } + Write-Debug "Enterprise : [$($Context.Enterprise)]" + + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" + + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo + } + Write-Debug "Repo : [$($Context.Repo)]" + } + + process { + try { + $body = @{ + per_page = $PerPage + } + + $inputObject = @{ + Context = $Context + APIEndpoint = "/orgs/$OrganizationName/blocks" + Method = 'GET' + Body = $body + } + + if ($PSCmdlet.ShouldProcess('Target', 'Operation')) { + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } + } catch { + Write-Debug "Error: $_" + } finally { + Write-Debug 'Finally' + } + } + + end { + Write-Debug "[$commandName] - End" + } + + clean { + Write-Debug 'Clean' + } +} From 8f86c077c9e6c1741f81571a9205903419c9784d Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions@users.noreply.github.com> Date: Sun, 15 Dec 2024 09:58:48 +0000 Subject: [PATCH 04/24] Auto-generated changes --- Coverage.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Coverage.md b/Coverage.md index 5dc35128..1a59c8f4 100644 --- a/Coverage.md +++ b/Coverage.md @@ -9,15 +9,15 @@ Covered functions - 155 + 156 Missing functions - 825 + 824 Coverage - 15.82% + 15.92% @@ -54,7 +54,7 @@ | `/emojis` | | :white_check_mark: | | | | | `/enterprises/{enterprise}/dependabot/alerts` | | :x: | | | | | `/enterprises/{enterprise}/secret-scanning/alerts` | | :x: | | | | -| `/events` | | :x: | | | | +| `/events` | | :white_check_mark: | | | | | `/feeds` | | :x: | | | | | `/gists` | | :x: | | :x: | | | `/gists/public` | | :x: | | | | From c7fa0925b145d221b1c3ec8acf2e84c814ae8f8e Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sun, 15 Dec 2024 11:51:52 +0100 Subject: [PATCH 05/24] Fix typos in documentation for workflow run cmdlets --- .../private/Actions/Get-GitHubWorkflowRunByWorkflow.ps1 | 4 ++-- src/functions/public/Actions/Get-GitHubWorkflowRun.ps1 | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/functions/private/Actions/Get-GitHubWorkflowRunByWorkflow.ps1 b/src/functions/private/Actions/Get-GitHubWorkflowRunByWorkflow.ps1 index 9a5647ce..93b8e723 100644 --- a/src/functions/private/Actions/Get-GitHubWorkflowRunByWorkflow.ps1 +++ b/src/functions/private/Actions/Get-GitHubWorkflowRunByWorkflow.ps1 @@ -4,7 +4,7 @@ List workflow runs for a workflow .DESCRIPTION - List all workflow runs for a workflow. You can replace `workflow_id` with the workflow file name. For example, you could use `main.yaml`. + List all workflow runs for a workflow. You can replace `workflow_id` with the workflow filename. For example, you could use `main.yaml`. You can use parameters to narrow the list of results. For more information about using parameters, see [Parameters](https://docs.github.com/rest/guides/getting-started-with-the-rest-api#parameters). Anyone with read access to the repository can use this endpoint @@ -39,7 +39,7 @@ [Parameter(Mandatory)] [string] $Repo, - # The ID of the workflow. You can also pass the workflow file name as a string. + # The ID of the workflow. You can also pass the workflow filename as a string. [Parameter(Mandatory)] [Alias('workflow_id', 'WorkflowID')] [string] $ID, diff --git a/src/functions/public/Actions/Get-GitHubWorkflowRun.ps1 b/src/functions/public/Actions/Get-GitHubWorkflowRun.ps1 index 48c645c7..18245f3d 100644 --- a/src/functions/public/Actions/Get-GitHubWorkflowRun.ps1 +++ b/src/functions/public/Actions/Get-GitHubWorkflowRun.ps1 @@ -73,7 +73,7 @@ [string] $Branch, # Returns workflow run triggered by the event you specify. For example, `push`, `pull_request` or `issue`. For more information, see - # "[Events that trigger workflows])(https://docs.github.com/actions/automating-your-workflow-with-github-actions/events-that-trigger-workflows)." + # "[Events that trigger workflows](https://docs.github.com/actions/automating-your-workflow-with-github-actions/events-that-trigger-workflows)." [Parameter()] [string] $Event, From 39bd5b0d3a6e25113aca87857814b0ff25dc290f Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sun, 15 Dec 2024 11:59:46 +0100 Subject: [PATCH 06/24] Fix --- src/functions/public/Actions/Get-GitHubWorkflowRun.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/functions/public/Actions/Get-GitHubWorkflowRun.ps1 b/src/functions/public/Actions/Get-GitHubWorkflowRun.ps1 index 18245f3d..c52abf3a 100644 --- a/src/functions/public/Actions/Get-GitHubWorkflowRun.ps1 +++ b/src/functions/public/Actions/Get-GitHubWorkflowRun.ps1 @@ -49,7 +49,7 @@ [Parameter(Mandatory)] [string] $Repo, - # The ID of the workflow. You can also pass the workflow file name as a string. + # The ID of the workflow. You can also pass the workflow filename as a string. [Parameter( Mandatory, ParameterSetName = 'ByID' From e073d29d3e75228593dbbee644450696f42f52c0 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sun, 15 Dec 2024 15:27:52 +0100 Subject: [PATCH 07/24] Replace Write-Verbose with Write-Debug for improved logging consistency across multiple scripts --- src/functions/public/API/Invoke-GitHubAPI.ps1 | 4 +- .../public/Apps/Get-GitHubAppJSONWebToken.ps1 | 5 +- .../public/Apps/GitHub Apps/Get-GitHubApp.ps1 | 37 ++++- .../public/Auth/Connect-GitHubAccount.ps1 | 4 +- .../public/Auth/Connect-GitHubApp.ps1 | 6 +- .../public/Auth/Context/Get-GitHubContext.ps1 | 4 +- .../Auth/Context/Set-GitHubDefaultContext.ps1 | 4 +- .../public/Auth/Disconnect-GitHubAccount.ps1 | 28 ++-- .../public/Auth/Get-GitHubViewer.ps1 | 15 +- .../Auth/Update-GitHubUserAccessToken.ps1 | 102 +++++++----- .../public/Branches/Get-GitHubRepoBranch.ps1 | 43 +++-- .../public/Commands/Add-GitHubMask.ps1 | 19 ++- .../public/Commands/Add-GitHubSystemPath.ps1 | 21 ++- .../public/Commands/Disable-GitHubCommand.ps1 | 21 ++- .../public/Commands/Enable-GitHubCommand.ps1 | 21 ++- .../public/Commands/Get-GitHubOutput.ps1 | 21 ++- .../Set-GitHubEnvironmentVariable.ps1 | 23 ++- .../public/Commands/Set-GitHubLogGroup.ps1 | 23 ++- .../Commands/Set-GitHubNoCommandGroup.ps1 | 23 ++- .../public/Commands/Set-GitHubOutput.ps1 | 63 +++++--- .../public/Commands/Set-GitHubStepSummary.ps1 | 23 ++- .../public/Commands/Start-GitHubLogGroup.ps1 | 17 +- .../public/Commands/Stop-GitHubLogGroup.ps1 | 17 +- .../public/Commands/Write-GitHubDebug.ps1 | 23 ++- .../public/Commands/Write-GitHubError.ps1 | 23 ++- .../public/Commands/Write-GitHubNotice.ps1 | 23 ++- .../public/Commands/Write-GitHubWarning.ps1 | 23 ++- .../public/Config/Get-GitHubConfig.ps1 | 16 +- .../public/Config/Remove-GitHubConfig.ps1 | 4 +- .../public/Config/Set-GitHubConfig.ps1 | 8 +- .../public/Emojis/Get-GitHubEmoji.ps1 | 43 +++-- ...itHubEnterpriseInstallableOrganization.ps1 | 36 +++-- .../Get-GitHubEnterpriseOrganization.ps1 | 77 +++++---- ...tall-GitHubAppOnEnterpriseOrganization.ps1 | 49 +++--- .../public/Git/Get-GitHubGitConfig.ps1 | 38 +++-- .../public/Git/Set-GitHubGitConfig.ps1 | 46 +++--- .../public/Gitignore/Get-GitHubGitignore.ps1 | 29 +++- .../GraphQL/Invoke-GitHubGraphQLQuery.ps1 | 33 ++-- .../public/License/Get-GitHubLicense.ps1 | 32 ++-- .../public/Markdown/Get-GitHubMarkdown.ps1 | 60 +++++-- .../public/Markdown/Get-GitHubMarkdownRaw.ps1 | 49 ++++-- .../public/Meta/Get-GitHubApiVersion.ps1 | 25 +-- src/functions/public/Meta/Get-GitHubMeta.ps1 | 25 +-- .../public/Meta/Get-GitHubOctocat.ps1 | 31 ++-- src/functions/public/Meta/Get-GitHubRoot.ps1 | 25 +-- src/functions/public/Meta/Get-GitHubZen.ps1 | 25 +-- .../Organization/Get-GitHubOrganization.ps1 | 50 ++++-- .../Get-GitHubOrganizationAppInstallation.ps1 | 43 +++-- .../Members/Get-GitHubOrganizationMember.ps1 | 47 ++++-- ...et-GitHubOrganizationPendingInvitation.ps1 | 47 ++++-- .../New-GitHubOrganizationInvitation.ps1 | 55 ++++--- .../Remove-GitHubOrganization.ps1 | 38 +++-- .../Organization/Set-GitHubOrganization.ps1 | 81 ++++++++-- .../Set-GitHubOrganizationSecurityFeature.ps1 | 51 +++--- .../public/Rate-Limit/Get-GitHubRateLimit.ps1 | 30 +++- .../Assets/Add-GitHubReleaseAsset.ps1 | 129 +++++++-------- .../Assets/Get-GitHubReleaseAsset.ps1 | 42 +++-- .../Assets/Remove-GitHubReleaseAsset.ps1 | 46 ++++-- .../Assets/Set-GitHubReleaseAsset.ps1 | 60 ++++--- .../Releases/Releases/Get-GitHubRelease.ps1 | 55 ++++--- .../Releases/Releases/New-GitHubRelease.ps1 | 72 +++++---- .../Releases/New-GitHubReleaseNote.ps1 | 59 ++++--- .../Releases/Remove-GitHubRelease.ps1 | 46 ++++-- .../Releases/Releases/Set-GitHubRelease.ps1 | 69 +++++--- .../Get-GitHubRepositoryAutolink.ps1 | 43 +++-- .../New-GitHubRepositoryAutolink.ps1 | 73 ++++----- .../Remove-GitHubRepositoryAutolink.ps1 | 49 ++++-- .../Get-GitHubRepositoryCustomProperty.ps1 | 43 +++-- ...epositoryPrivateVulnerabilityReporting.ps1 | 47 ++++-- .../Disable-GitHubRepositorySecurityFix.ps1 | 47 ++++-- ...ble-GitHubRepositoryVulnerabilityAlert.ps1 | 47 ++++-- ...epositoryPrivateVulnerabilityReporting.ps1 | 47 ++++-- .../Enable-GitHubRepositorySecurityFix.ps1 | 47 ++++-- ...ble-GitHubRepositoryVulnerabilityAlert.ps1 | 47 ++++-- .../Repositories/Get-GitHubRepository.ps1 | 130 ++++++++------- .../Get-GitHubRepositoryActivity.ps1 | 74 +++++---- .../Get-GitHubRepositoryCodeownersError.ps1 | 67 ++++---- .../Get-GitHubRepositoryContributor.ps1 | 57 ++++--- .../Repositories/Get-GitHubRepositoryFork.ps1 | 68 ++++---- .../Get-GitHubRepositoryLanguage.ps1 | 43 +++-- .../Get-GitHubRepositorySecurityFix.ps1 | 43 +++-- .../Repositories/Get-GitHubRepositoryTag.ps1 | 51 +++--- .../Repositories/Get-GitHubRepositoryTeam.ps1 | 57 ++++--- .../Get-GitHubRepositoryTopic.ps1 | 51 +++--- .../Repositories/Move-GitHubRepository.ps1 | 69 ++++---- .../Repositories/New-GitHubRepository.ps1 | 148 ++++++++++-------- .../Repositories/Remove-GitHubRepository.ps1 | 47 ++++-- .../Set-GitHubRepositoryTopic.ps1 | 55 ++++--- .../Start-GitHubRepositoryEvent.ps1 | 66 ++++---- ...est-GitHubRepositoryVulnerabilityAlert.ps1 | 51 +++--- .../Repositories/Update-GitHubRepository.ps1 | 126 ++++++++------- .../Get-GitHubRepositoryRuleSuite.ps1 | 73 +++++---- .../Get-GitHubRepositoryRuleSuiteById.ps1 | 43 +++-- .../Get-GitHubRepositoryRuleSuiteList.ps1 | 71 +++++---- .../Get-GitHubRepositoryTagProtection.ps1 | 43 +++-- .../New-GitHubRepositoryTagProtection.ps1 | 55 ++++--- .../Remove-GitHubRepositoryTagProtection.ps1 | 47 ++++-- .../Status/Get-GitHubScheduledMaintenance.ps1 | 45 ++++-- .../public/Status/Get-GitHubStatus.ps1 | 32 ++-- .../Status/Get-GitHubStatusComponent.ps1 | 23 ++- .../Status/Get-GitHubStatusIncident.ps1 | 33 ++-- .../public/Teams/Get-GitHubRepoTeam.ps1 | 43 +++-- .../public/Teams/Get-GitHubTeamByName.ps1 | 35 +++-- .../public/Teams/Get-GitHubTeamListByOrg.ps1 | 37 +++-- src/functions/public/Teams/New-GitHubTeam.ps1 | 66 +++++--- .../public/Teams/Remove-GitHubTeam.ps1 | 39 +++-- .../public/Teams/Update-GitHubTeam.ps1 | 62 +++++--- .../Users/Blocking/Block-GitHubUser.ps1 | 42 +++-- .../Users/Blocking/Get-GitHubBlockedUser.ps1 | 30 +++- .../Users/Blocking/Test-GitHubBlockedUser.ps1 | 31 +++- .../Users/Blocking/Unblock-GitHubUser.ps1 | 31 +++- .../Users/Emails/Add-GitHubUserEmail.ps1 | 38 +++-- .../Users/Emails/Get-GitHubUserEmail.ps1 | 25 ++- .../Users/Emails/Remove-GitHubUserEmail.ps1 | 40 +++-- .../Emails/Set-GitHubUserEmailVisibility.ps1 | 40 +++-- .../Followers/Add-GitHubUserFollowing.ps1 | 30 +++- .../Followers/Get-GitHubUserFollower.ps1 | 25 ++- .../Followers/Get-GitHubUserFollowing.ps1 | 25 ++- .../Followers/Remove-GitHubUserFollowing.ps1 | 33 ++-- .../Followers/Test-GitHubUserFollowing.ps1 | 25 ++- .../Users/GPG-Keys/Add-GitHubUserGpgKey.ps1 | 39 +++-- .../Users/GPG-Keys/Get-GitHubUserGpgKey.ps1 | 31 +++- .../GPG-Keys/Remove-GitHubUserGpgKey.ps1 | 33 ++-- src/functions/public/Users/Get-GitHubUser.ps1 | 47 ++++-- .../public/Users/Get-GitHubUserCard.ps1 | 39 +++-- .../public/Users/Keys/Add-GitHubUserKey.ps1 | 39 +++-- .../public/Users/Keys/Get-GitHubUserKey.ps1 | 31 +++- .../Users/Keys/Remove-GitHubUserKey.ps1 | 33 ++-- .../Add-GitHubUserSigningKey.ps1 | 39 +++-- .../Get-GitHubUserSigningKey.ps1 | 31 +++- .../Remove-GitHubUserSigningKey.ps1 | 33 ++-- src/functions/public/Users/Set-GitHubUser.ps1 | 55 ++++--- .../Social-Accounts/Add-GitHubUserSocial.ps1 | 38 +++-- .../Remove-GitHubUserSocial.ps1 | 41 +++-- tools/utilities/GitHubAPI.ps1 | 4 +- 135 files changed, 3712 insertions(+), 1983 deletions(-) diff --git a/src/functions/public/API/Invoke-GitHubAPI.ps1 b/src/functions/public/API/Invoke-GitHubAPI.ps1 index 1c71f940..b8c9a3b2 100644 --- a/src/functions/public/API/Invoke-GitHubAPI.ps1 +++ b/src/functions/public/API/Invoke-GitHubAPI.ps1 @@ -84,7 +84,7 @@ begin { $commandName = $MyInvocation.MyCommand.Name - Write-Verbose "[$commandName] - Start" + Write-Debug "[$commandName] - Start" $Context = Resolve-GitHubContext -Context $Context Write-Debug 'Invoking GitHub API...' Write-Debug 'Parameters:' @@ -251,6 +251,6 @@ } end { - Write-Verbose "[$commandName] - End" + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Apps/Get-GitHubAppJSONWebToken.ps1 b/src/functions/public/Apps/Get-GitHubAppJSONWebToken.ps1 index 18318fe7..ed637083 100644 --- a/src/functions/public/Apps/Get-GitHubAppJSONWebToken.ps1 +++ b/src/functions/public/Apps/Get-GitHubAppJSONWebToken.ps1 @@ -68,7 +68,7 @@ function Get-GitHubAppJSONWebToken { begin { $commandName = $MyInvocation.MyCommand.Name - Write-Verbose "[$commandName] - Start" + Write-Debug "[$commandName] - Start" } process { @@ -129,8 +129,7 @@ function Get-GitHubAppJSONWebToken { } end { - $commandName = $MyInvocation.MyCommand.Name - Write-Verbose "[$commandName] - End" + Write-Debug "[$commandName] - End" } clean { diff --git a/src/functions/public/Apps/GitHub Apps/Get-GitHubApp.ps1 b/src/functions/public/Apps/GitHub Apps/Get-GitHubApp.ps1 index 7c38e113..41ab6183 100644 --- a/src/functions/public/Apps/GitHub Apps/Get-GitHubApp.ps1 +++ b/src/functions/public/Apps/GitHub Apps/Get-GitHubApp.ps1 @@ -39,12 +39,39 @@ [object] $Context = (Get-GitHubContext) ) - switch ($PSCmdlet.ParameterSetName) { - 'BySlug' { - Get-GitHubAppByName -AppSlug $AppSlug -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner } - default { - Get-GitHubAuthenticatedApp -Context $Context + Write-Debug "Owner : [$($Context.Owner)]" + + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo + } + Write-Debug "Repo : [$($Context.Repo)]" + } + + process { + try { + switch ($PSCmdlet.ParameterSetName) { + 'BySlug' { + Get-GitHubAppByName -AppSlug $AppSlug -Context $Context + } + default { + Get-GitHubAuthenticatedApp -Context $Context + } + } + } catch { + throw $_ } } + + end { + Write-Debug "[$commandName] - End" + } } + diff --git a/src/functions/public/Auth/Connect-GitHubAccount.ps1 b/src/functions/public/Auth/Connect-GitHubAccount.ps1 index d760ee17..a88b87fd 100644 --- a/src/functions/public/Auth/Connect-GitHubAccount.ps1 +++ b/src/functions/public/Auth/Connect-GitHubAccount.ps1 @@ -149,7 +149,7 @@ begin { $commandName = $MyInvocation.MyCommand.Name - Write-Verbose "[$commandName] - Start" + Write-Debug "[$commandName] - Start" } process { @@ -315,7 +315,7 @@ } end { - Write-Verbose "[$commandName] - End" + Write-Debug "[$commandName] - End" } clean { diff --git a/src/functions/public/Auth/Connect-GitHubApp.ps1 b/src/functions/public/Auth/Connect-GitHubApp.ps1 index 0fa7235f..905d21fd 100644 --- a/src/functions/public/Auth/Connect-GitHubApp.ps1 +++ b/src/functions/public/Auth/Connect-GitHubApp.ps1 @@ -69,7 +69,7 @@ function Connect-GitHubApp { begin { $commandName = $MyInvocation.MyCommand.Name - Write-Verbose "[$commandName] - Start" + Write-Debug "[$commandName] - Start" } process { @@ -139,11 +139,11 @@ function Connect-GitHubApp { } } catch { Write-Error $_ - Write-Error (Get-PSCallStack | Format-Table | Out-String) throw 'Failed to connect to GitHub using a GitHub App.' } } + end { - Write-Verbose "[$commandName] - End" + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Auth/Context/Get-GitHubContext.ps1 b/src/functions/public/Auth/Context/Get-GitHubContext.ps1 index 3d07d8f7..41ca9972 100644 --- a/src/functions/public/Auth/Context/Get-GitHubContext.ps1 +++ b/src/functions/public/Auth/Context/Get-GitHubContext.ps1 @@ -38,7 +38,7 @@ function Get-GitHubContext { begin { $commandName = $MyInvocation.MyCommand.Name - Write-Verbose "[$commandName] - Start" + Write-Debug "[$commandName] - Start" $null = Get-GitHubConfig } @@ -88,6 +88,6 @@ function Get-GitHubContext { } end { - Write-Verbose "[$commandName] - End" + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Auth/Context/Set-GitHubDefaultContext.ps1 b/src/functions/public/Auth/Context/Set-GitHubDefaultContext.ps1 index 82a51d3b..b772df12 100644 --- a/src/functions/public/Auth/Context/Set-GitHubDefaultContext.ps1 +++ b/src/functions/public/Auth/Context/Set-GitHubDefaultContext.ps1 @@ -19,7 +19,7 @@ begin { $commandName = $MyInvocation.MyCommand.Name - Write-Verbose "[$commandName] - Start" + Write-Debug "[$commandName] - Start" $Context = Resolve-GitHubContext -Context $Context } @@ -30,6 +30,6 @@ } end { - Write-Verbose "[$commandName] - End" + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Auth/Disconnect-GitHubAccount.ps1 b/src/functions/public/Auth/Disconnect-GitHubAccount.ps1 index f970da72..e18e93ac 100644 --- a/src/functions/public/Auth/Disconnect-GitHubAccount.ps1 +++ b/src/functions/public/Auth/Disconnect-GitHubAccount.ps1 @@ -48,26 +48,30 @@ begin { $commandName = $MyInvocation.MyCommand.Name - Write-Verbose "[$commandName] - Start" + Write-Debug "[$commandName] - Start" $Context = Resolve-GitHubContext -Context $Context } process { - Remove-GitHubContext -Context $Context - $isDefaultContext = $Context.Name -eq $script:GitHub.Config.DefaultContext - if ($isDefaultContext) { - Remove-GitHubConfig -Name 'DefaultContext' - Write-Warning 'There is no longer a default context!' - Write-Warning "Please set a new default context using 'Set-GitHubDefaultContext -Name '" - } + try { + Remove-GitHubContext -Context $Context + $isDefaultContext = $Context.Name -eq $script:GitHub.Config.DefaultContext + if ($isDefaultContext) { + Remove-GitHubConfig -Name 'DefaultContext' + Write-Warning 'There is no longer a default context!' + Write-Warning "Please set a new default context using 'Set-GitHubDefaultContext -Name '" + } - if (-not $Silent) { - Write-Host '✓ ' -ForegroundColor Green -NoNewline - Write-Host "Logged out of GitHub! [$Context]" + if (-not $Silent) { + Write-Host '✓ ' -ForegroundColor Green -NoNewline + Write-Host "Logged out of GitHub! [$Context]" + } + } catch { + throw $_ } } end { - Write-Verbose "[$commandName] - End" + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Auth/Get-GitHubViewer.ps1 b/src/functions/public/Auth/Get-GitHubViewer.ps1 index 7faf9602..f7a896f4 100644 --- a/src/functions/public/Auth/Get-GitHubViewer.ps1 +++ b/src/functions/public/Auth/Get-GitHubViewer.ps1 @@ -28,25 +28,28 @@ begin { $commandName = $MyInvocation.MyCommand.Name - Write-Verbose "[$commandName] - Start" + Write-Debug "[$commandName] - Start" $Context = Resolve-GitHubContext -Context $Context } process { - - $query = @" + try { + $query = @" query { viewer { $($Fields -join "`n") } } "@ - $results = Invoke-GitHubGraphQLQuery -Query $query -Context $Context + $results = Invoke-GitHubGraphQLQuery -Query $query -Context $Context - $results.data.viewer + $results.data.viewer + } catch { + throw $_ + } } end { - Write-Verbose "[$commandName] - End" + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Auth/Update-GitHubUserAccessToken.ps1 b/src/functions/public/Auth/Update-GitHubUserAccessToken.ps1 index 8e600b12..0b0ca815 100644 --- a/src/functions/public/Auth/Update-GitHubUserAccessToken.ps1 +++ b/src/functions/public/Auth/Update-GitHubUserAccessToken.ps1 @@ -35,54 +35,70 @@ [switch] $PassThru ) - $Context = Resolve-GitHubContext -Context $Context - Write-Verbose "Reusing previously stored ClientID: [$($Context.AuthClientID)]" - $authClientID = $Context.AuthClientID - $accessTokenValidity = [datetime]($Context.TokenExpirationDate) - (Get-Date) - $accessTokenIsValid = $accessTokenValidity.Seconds -gt 0 - $hours = $accessTokenValidity.Hours.ToString().PadLeft(2, '0') - $minutes = $accessTokenValidity.Minutes.ToString().PadLeft(2, '0') - $seconds = $accessTokenValidity.Seconds.ToString().PadLeft(2, '0') - $accessTokenValidityText = "$hours`:$minutes`:$seconds" - if ($accessTokenIsValid) { - if ($accessTokenValidity.TotalHours -gt $script:GitHub.Config.AccessTokenGracePeriodInHours) { - if (-not $Silent) { - Write-Host '✓ ' -ForegroundColor Green -NoNewline - Write-Host "Access token is still valid for $accessTokenValidityText ..." + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType UAT + } + + process { + try { + Write-Verbose "Reusing previously stored ClientID: [$($Context.AuthClientID)]" + $authClientID = $Context.AuthClientID + $accessTokenValidity = [datetime]($Context.TokenExpirationDate) - (Get-Date) + $accessTokenIsValid = $accessTokenValidity.Seconds -gt 0 + $hours = $accessTokenValidity.Hours.ToString().PadLeft(2, '0') + $minutes = $accessTokenValidity.Minutes.ToString().PadLeft(2, '0') + $seconds = $accessTokenValidity.Seconds.ToString().PadLeft(2, '0') + $accessTokenValidityText = "$hours`:$minutes`:$seconds" + if ($accessTokenIsValid) { + if ($accessTokenValidity.TotalHours -gt $script:GitHub.Config.AccessTokenGracePeriodInHours) { + if (-not $Silent) { + Write-Host '✓ ' -ForegroundColor Green -NoNewline + Write-Host "Access token is still valid for $accessTokenValidityText ..." + } + return + } else { + if (-not $Silent) { + Write-Host '⚠ ' -ForegroundColor Yellow -NoNewline + Write-Host "Access token remaining validity $accessTokenValidityText. Refreshing access token..." + } + $tokenResponse = Invoke-GitHubDeviceFlowLogin -ClientID $authClientID -RefreshToken ($Context.RefreshToken) -HostName $Context.HostName + } + } else { + $refreshTokenValidity = [datetime]($Context.RefreshTokenExpirationDate) - (Get-Date) + $refreshTokenIsValid = $refreshTokenValidity.Seconds -gt 0 + if ($refreshTokenIsValid) { + if (-not $Silent) { + Write-Host '⚠ ' -ForegroundColor Yellow -NoNewline + Write-Host 'Access token expired. Refreshing access token...' + } + $tokenResponse = Invoke-GitHubDeviceFlowLogin -ClientID $authClientID -RefreshToken ($Context.RefreshToken) -HostName $Context.HostName + } else { + Write-Verbose "Using $Mode authentication..." + $tokenResponse = Invoke-GitHubDeviceFlowLogin -ClientID $authClientID -Scope $Scope -HostName $Context.HostName + } } - return - } else { - if (-not $Silent) { - Write-Host '⚠ ' -ForegroundColor Yellow -NoNewline - Write-Host "Access token remaining validity $accessTokenValidityText. Refreshing access token..." + $Context.Token = ConvertTo-SecureString -AsPlainText $tokenResponse.access_token + $Context.TokenExpirationDate = (Get-Date).AddSeconds($tokenResponse.expires_in) + $Context.TokenType = $tokenResponse.access_token -replace $script:GitHub.TokenPrefixPattern + $Context.RefreshToken = ConvertTo-SecureString -AsPlainText $tokenResponse.refresh_token + $Context.RefreshTokenExpirationDate = (Get-Date).AddSeconds($tokenResponse.refresh_token_expires_in) + + if ($PSCmdlet.ShouldProcess('Access token', 'Update/refresh')) { + Set-GitHubContext -Context $Context } - $tokenResponse = Invoke-GitHubDeviceFlowLogin -ClientID $authClientID -RefreshToken ($Context.RefreshToken) -HostName $Context.HostName - } - } else { - $refreshTokenValidity = [datetime]($Context.RefreshTokenExpirationDate) - (Get-Date) - $refreshTokenIsValid = $refreshTokenValidity.Seconds -gt 0 - if ($refreshTokenIsValid) { - if (-not $Silent) { - Write-Host '⚠ ' -ForegroundColor Yellow -NoNewline - Write-Host 'Access token expired. Refreshing access token...' + + if ($PassThru) { + $Context.Token } - $tokenResponse = Invoke-GitHubDeviceFlowLogin -ClientID $authClientID -RefreshToken ($Context.RefreshToken) -HostName $Context.HostName - } else { - Write-Verbose "Using $Mode authentication..." - $tokenResponse = Invoke-GitHubDeviceFlowLogin -ClientID $authClientID -Scope $Scope -HostName $Context.HostName + } catch { + throw $_ } } - $Context.Token = ConvertTo-SecureString -AsPlainText $tokenResponse.access_token - $Context.TokenExpirationDate = (Get-Date).AddSeconds($tokenResponse.expires_in) - $Context.TokenType = $tokenResponse.access_token -replace $script:GitHub.TokenPrefixPattern - $Context.RefreshToken = ConvertTo-SecureString -AsPlainText $tokenResponse.refresh_token - $Context.RefreshTokenExpirationDate = (Get-Date).AddSeconds($tokenResponse.refresh_token_expires_in) - - if ($PSCmdlet.ShouldProcess('Access token', 'Update/refresh')) { - Set-GitHubContext -Context $Context - } - if ($PassThru) { - $Context.Token + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Branches/Get-GitHubRepoBranch.ps1 b/src/functions/public/Branches/Get-GitHubRepoBranch.ps1 index 5a3c25c3..c21ac4f5 100644 --- a/src/functions/public/Branches/Get-GitHubRepoBranch.ps1 +++ b/src/functions/public/Branches/Get-GitHubRepoBranch.ps1 @@ -30,25 +30,40 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo + } + Write-Debug "Repo : [$($Context.Repo)]" } - Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo - } - Write-Debug "Repo : [$($Context.Repo)]" + process { + try { + $inputObject = @{ + Context = $Context + APIEndpoint = "/repos/$Owner/$Repo/branches" + Method = 'GET' + } - $inputObject = @{ - Context = $Context - APIEndpoint = "/repos/$Owner/$Repo/branches" - Method = 'GET' + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + end { + Write-Debug "[$commandName] - End" } } + diff --git a/src/functions/public/Commands/Add-GitHubMask.ps1 b/src/functions/public/Commands/Add-GitHubMask.ps1 index 85f257b1..e3ad9e8d 100644 --- a/src/functions/public/Commands/Add-GitHubMask.ps1 +++ b/src/functions/public/Commands/Add-GitHubMask.ps1 @@ -46,7 +46,22 @@ [string[]] $Value ) - foreach ($item in $Value) { - Write-Host "::add-mask::$item" + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + } + + process { + try { + foreach ($item in $Value) { + Write-Host "::add-mask::$item" + } + } catch { + throw $_ + } + } + + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Commands/Add-GitHubSystemPath.ps1 b/src/functions/public/Commands/Add-GitHubSystemPath.ps1 index 02154c13..30ff6392 100644 --- a/src/functions/public/Commands/Add-GitHubSystemPath.ps1 +++ b/src/functions/public/Commands/Add-GitHubSystemPath.ps1 @@ -24,8 +24,23 @@ [string]$Path ) - Write-Verbose "Current PATH: $env:PATH" - Write-Verbose "Adding system path: $Path" + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + } - $Path | Out-File -FilePath $env:GITHUB_PATH -Append + process { + try { + Write-Verbose "Current PATH: $env:PATH" + Write-Verbose "Adding system path: $Path" + + $Path | Out-File -FilePath $env:GITHUB_PATH -Append + } catch { + throw $_ + } + } + + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/public/Commands/Disable-GitHubCommand.ps1 b/src/functions/public/Commands/Disable-GitHubCommand.ps1 index bfc89d4f..b8644631 100644 --- a/src/functions/public/Commands/Disable-GitHubCommand.ps1 +++ b/src/functions/public/Commands/Disable-GitHubCommand.ps1 @@ -34,9 +34,24 @@ [string] $String ) - $String = $String.ToLower() + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + } + + process { + try { + $String = $String.ToLower() + + if ($env:GITHUB_ACTIONS -eq 'true') { + Write-Host "::stop-commands::$String" + } + } catch { + throw $_ + } + } - if ($env:GITHUB_ACTIONS -eq 'true') { - Write-Host "::stop-commands::$String" + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Commands/Enable-GitHubCommand.ps1 b/src/functions/public/Commands/Enable-GitHubCommand.ps1 index 2fa7e2f0..f3339f84 100644 --- a/src/functions/public/Commands/Enable-GitHubCommand.ps1 +++ b/src/functions/public/Commands/Enable-GitHubCommand.ps1 @@ -33,9 +33,24 @@ [string] $String ) - $String = $String.ToLower() + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + } + + process { + try { + $String = $String.ToLower() + + if ($env:GITHUB_ACTIONS -eq 'true') { + Write-Host "::$String::" + } + } catch { + throw $_ + } + } - if ($env:GITHUB_ACTIONS -eq 'true') { - Write-Host "::$String::" + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Commands/Get-GitHubOutput.ps1 b/src/functions/public/Commands/Get-GitHubOutput.ps1 index d881803d..1d2e44ec 100644 --- a/src/functions/public/Commands/Get-GitHubOutput.ps1 +++ b/src/functions/public/Commands/Get-GitHubOutput.ps1 @@ -40,9 +40,24 @@ [string] $Path = $env:GITHUB_OUTPUT ) - if (-not (Test-Path -Path $Path)) { - throw "File not found: $Path" + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" } - Get-Content -Path $Path | ConvertFrom-GitHubOutput -AsHashtable:$AsHashtable + process { + try { + if (-not (Test-Path -Path $Path)) { + throw "File not found: $Path" + } + + Get-Content -Path $Path | ConvertFrom-GitHubOutput -AsHashtable:$AsHashtable + } catch { + throw $_ + } + } + + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/public/Commands/Set-GitHubEnvironmentVariable.ps1 b/src/functions/public/Commands/Set-GitHubEnvironmentVariable.ps1 index 38646ba4..e77ff3d0 100644 --- a/src/functions/public/Commands/Set-GitHubEnvironmentVariable.ps1 +++ b/src/functions/public/Commands/Set-GitHubEnvironmentVariable.ps1 @@ -34,13 +34,28 @@ [string] $Value ) - Write-Verbose "Env: [$Name] = [$Value]" + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + } - $guid = [guid]::NewGuid().Guid - $content = @" + process { + try { + Write-Verbose "Env: [$Name] = [$Value]" + + $guid = [guid]::NewGuid().Guid + $content = @" $Name<<$guid $Value $guid "@ - $content | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + $content | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + } catch { + throw $_ + } + } + + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/public/Commands/Set-GitHubLogGroup.ps1 b/src/functions/public/Commands/Set-GitHubLogGroup.ps1 index a3516a76..5f402e7e 100644 --- a/src/functions/public/Commands/Set-GitHubLogGroup.ps1 +++ b/src/functions/public/Commands/Set-GitHubLogGroup.ps1 @@ -40,11 +40,22 @@ [scriptblock] $ScriptBlock ) - Start-GitHubLogGroup -Name $Name - try { - . $ScriptBlock - } catch { - throw $_ + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + } + + process { + Start-GitHubLogGroup -Name $Name + try { + . $ScriptBlock + } catch { + throw $_ + } + Stop-GitHubLogGroup + } + + end { + Write-Debug "[$commandName] - End" } - Stop-GitHubLogGroup } diff --git a/src/functions/public/Commands/Set-GitHubNoCommandGroup.ps1 b/src/functions/public/Commands/Set-GitHubNoCommandGroup.ps1 index de57f2d3..9f18edde 100644 --- a/src/functions/public/Commands/Set-GitHubNoCommandGroup.ps1 +++ b/src/functions/public/Commands/Set-GitHubNoCommandGroup.ps1 @@ -42,9 +42,24 @@ [scriptblock] $ScriptBlock ) - $guid = [string][guid]::NewGuid().Guid + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + } - Disable-GitHubCommand -String $guid - . $ScriptBlock - Enable-GitHubCommand -String $guid + process { + $guid = [string][guid]::NewGuid().Guid + + Disable-GitHubCommand -String $guid + try { + . $ScriptBlock + } catch { + throw $_ + } + Enable-GitHubCommand -String $guid + } + + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/public/Commands/Set-GitHubOutput.ps1 b/src/functions/public/Commands/Set-GitHubOutput.ps1 index 992ce488..6bff0674 100644 --- a/src/functions/public/Commands/Set-GitHubOutput.ps1 +++ b/src/functions/public/Commands/Set-GitHubOutput.ps1 @@ -36,39 +36,54 @@ [string] $Path = $env:GITHUB_OUTPUT ) - if (-not (Test-Path -Path $Path)) { - throw "File not found: $Path" + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" } - $outputs = Get-GitHubOutput -Path $Path -AsHashtable + process { + try { + if (-not (Test-Path -Path $Path)) { + throw "File not found: $Path" + } - if ($Value -Is [securestring]) { - $Value = $Value | ConvertFrom-SecureString -AsPlainText -Force - Add-Mask -Value $Value - } + $outputs = Get-GitHubOutput -Path $Path -AsHashtable - if ([string]::IsNullOrEmpty($env:GITHUB_ACTION)) { - Write-Warning 'Cannot create output as the step has no ID.' - } + if ($Value -Is [securestring]) { + $Value = $Value | ConvertFrom-SecureString -AsPlainText -Force + Add-Mask -Value $Value + } + + if ([string]::IsNullOrEmpty($env:GITHUB_ACTION)) { + Write-Warning 'Cannot create output as the step has no ID.' + } - Write-Verbose "Output: [$Name] = [$Value]" + Write-Verbose "Output: [$Name] = [$Value]" - # If the script is running in a GitHub composite action, accumulate the output under the 'result' key, else append the key-value pair directly. - if ($env:PSMODULE_GITHUB_SCRIPT) { - if (-not $outputs.result) { - $outputs.result = @{ - $Name = $Value + # If the script is running in a GitHub composite action, accumulate the output under the 'result' key, else append the key-value pair directly. + if ($env:PSMODULE_GITHUB_SCRIPT) { + if (-not $outputs.result) { + $outputs.result = @{ + $Name = $Value + } + } else { + $outputs.result[$Name] = $Value + } + } else { + $outputs[$Name] = $Value } - } else { - $outputs.result[$Name] = $Value + + Write-Verbose "Output: [$Name] avaiable as `${{ steps.$env:GITHUB_ACTION.outputs.$Name }}'" + + if ($PSCmdlet.ShouldProcess('GitHub Output', 'Set')) { + $outputs | ConvertTo-GitHubOutput | Set-Content -Path $Path + } + } catch { + throw $_ } - } else { - $outputs[$Name] = $Value } - Write-Verbose "Output: [$Name] avaiable as `${{ steps.$env:GITHUB_ACTION.outputs.$Name }}'" - - if ($PSCmdlet.ShouldProcess('GitHub Output', 'Set')) { - $outputs | ConvertTo-GitHubOutput | Set-Content -Path $Path + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Commands/Set-GitHubStepSummary.ps1 b/src/functions/public/Commands/Set-GitHubStepSummary.ps1 index c987e526..7cf6ea10 100644 --- a/src/functions/public/Commands/Set-GitHubStepSummary.ps1 +++ b/src/functions/public/Commands/Set-GitHubStepSummary.ps1 @@ -42,9 +42,24 @@ [switch] $Overwrite ) - Write-Verbose 'Step summary:' - Write-Verbose $Summary + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + } - $Append = -not $Overwrite - $Summary | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Encoding utf8 -Append:$Append + process { + try { + Write-Verbose 'Step summary:' + Write-Verbose $Summary + + $Append = -not $Overwrite + $Summary | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Encoding utf8 -Append:$Append + } catch { + throw $_ + } + } + + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/public/Commands/Start-GitHubLogGroup.ps1 b/src/functions/public/Commands/Start-GitHubLogGroup.ps1 index a32b4525..7d221e17 100644 --- a/src/functions/public/Commands/Start-GitHubLogGroup.ps1 +++ b/src/functions/public/Commands/Start-GitHubLogGroup.ps1 @@ -27,5 +27,20 @@ [string] $Name ) - Write-Host "::group::$Name" + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + } + + process { + try { + Write-Host "::group::$Name" + } catch { + throw $_ + } + } + + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/public/Commands/Stop-GitHubLogGroup.ps1 b/src/functions/public/Commands/Stop-GitHubLogGroup.ps1 index 04d6229d..1755ff4a 100644 --- a/src/functions/public/Commands/Stop-GitHubLogGroup.ps1 +++ b/src/functions/public/Commands/Stop-GitHubLogGroup.ps1 @@ -23,5 +23,20 @@ [Alias('Stop-LogGroup')] param() - Write-Host '::endgroup::' + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + } + + process { + try { + Write-Host '::endgroup::' + } catch { + throw $_ + } + } + + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/public/Commands/Write-GitHubDebug.ps1 b/src/functions/public/Commands/Write-GitHubDebug.ps1 index 4001415b..e1e4dceb 100644 --- a/src/functions/public/Commands/Write-GitHubDebug.ps1 +++ b/src/functions/public/Commands/Write-GitHubDebug.ps1 @@ -35,9 +35,24 @@ [string] $Message ) - if ($env:GITHUB_ACTIONS -eq 'true') { - Write-Host "::debug::$Message" - } else { - Write-Debug "$Message" + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + } + + process { + try { + if ($env:GITHUB_ACTIONS -eq 'true') { + Write-Host "::debug::$Message" + } else { + Write-Debug "$Message" + } + } catch { + throw $_ + } + } + + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Commands/Write-GitHubError.ps1 b/src/functions/public/Commands/Write-GitHubError.ps1 index de1743fd..9f1dae0c 100644 --- a/src/functions/public/Commands/Write-GitHubError.ps1 +++ b/src/functions/public/Commands/Write-GitHubError.ps1 @@ -55,9 +55,24 @@ [string] $Title ) - if ($env:GITHUB_ACTIONS -eq 'true') { - Write-Host "::error file=$Name,line=$Line,col=$Column,endColumn=$EndColumn,endLine=$EndLine,title=$Title::$Message" - } else { - Write-Error $Message + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + } + + process { + try { + if ($env:GITHUB_ACTIONS -eq 'true') { + Write-Host "::error file=$Name,line=$Line,col=$Column,endColumn=$EndColumn,endLine=$EndLine,title=$Title::$Message" + } else { + Write-Error $Message + } + } catch { + throw $_ + } + } + + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Commands/Write-GitHubNotice.ps1 b/src/functions/public/Commands/Write-GitHubNotice.ps1 index 51b3ac9e..3413690c 100644 --- a/src/functions/public/Commands/Write-GitHubNotice.ps1 +++ b/src/functions/public/Commands/Write-GitHubNotice.ps1 @@ -55,9 +55,24 @@ [string] $Title ) - if ($env:GITHUB_ACTIONS -eq 'true') { - Write-Host "::notice file=$Name,line=$Line,col=$Column,endColumn=$EndColumn,endLine=$EndLine,title=$Title::$Message" - } else { - Write-Host $Message + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + } + + process { + try { + if ($env:GITHUB_ACTIONS -eq 'true') { + Write-Host "::notice file=$Name,line=$Line,col=$Column,endColumn=$EndColumn,endLine=$EndLine,title=$Title::$Message" + } else { + Write-Host $Message + } + } catch { + throw $_ + } + } + + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Commands/Write-GitHubWarning.ps1 b/src/functions/public/Commands/Write-GitHubWarning.ps1 index c4fb8f50..6209b00a 100644 --- a/src/functions/public/Commands/Write-GitHubWarning.ps1 +++ b/src/functions/public/Commands/Write-GitHubWarning.ps1 @@ -55,9 +55,24 @@ [string] $Title ) - if ($env:GITHUB_ACTIONS -eq 'true') { - Write-Host "::warning file=$Name,line=$Line,col=$Column,endColumn=$EndColumn,endLine=$EndLine,title=$Title::$Message" - } else { - Write-Warning $Message + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + } + + process { + try { + if ($env:GITHUB_ACTIONS -eq 'true') { + Write-Host "::warning file=$Name,line=$Line,col=$Column,endColumn=$EndColumn,endLine=$EndLine,title=$Title::$Message" + } else { + Write-Warning $Message + } + } catch { + throw $_ + } + } + + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Config/Get-GitHubConfig.ps1 b/src/functions/public/Config/Get-GitHubConfig.ps1 index f854c5b5..102ea6e9 100644 --- a/src/functions/public/Config/Get-GitHubConfig.ps1 +++ b/src/functions/public/Config/Get-GitHubConfig.ps1 @@ -23,19 +23,23 @@ function Get-GitHubConfig { begin { $commandName = $MyInvocation.MyCommand.Name - Write-Verbose "[$commandName] - Start" + Write-Debug "[$commandName] - Start" Initialize-GitHubConfig } process { - if (-not $Name) { - return [GitHubConfig]($script:GitHub.Config) + try { + if (-not $Name) { + return [GitHubConfig]($script:GitHub.Config) + } + + $script:GitHub.Config.$Name + } catch { + throw $_ } - - $script:GitHub.Config.$Name } end { - Write-Verbose "[$commandName] - End" + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Config/Remove-GitHubConfig.ps1 b/src/functions/public/Config/Remove-GitHubConfig.ps1 index 54159e27..b1decc82 100644 --- a/src/functions/public/Config/Remove-GitHubConfig.ps1 +++ b/src/functions/public/Config/Remove-GitHubConfig.ps1 @@ -22,7 +22,7 @@ function Remove-GitHubConfig { begin { $commandName = $MyInvocation.MyCommand.Name - Write-Verbose "[$commandName] - Start" + Write-Debug "[$commandName] - Start" Initialize-GitHubConfig } @@ -40,6 +40,6 @@ function Remove-GitHubConfig { } end { - Write-Verbose "[$commandName] - End" + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Config/Set-GitHubConfig.ps1 b/src/functions/public/Config/Set-GitHubConfig.ps1 index 5f0816ae..7bf0ace4 100644 --- a/src/functions/public/Config/Set-GitHubConfig.ps1 +++ b/src/functions/public/Config/Set-GitHubConfig.ps1 @@ -26,14 +26,14 @@ function Set-GitHubConfig { begin { $commandName = $MyInvocation.MyCommand.Name - Write-Verbose "[$commandName] - Start" + Write-Debug "[$commandName] - Start" Initialize-GitHubConfig } process { - Write-Verbose "Setting [$Name] to [$Value]" - $script:GitHub.Config.$Name = $Value try { + Write-Verbose "Setting [$Name] to [$Value]" + $script:GitHub.Config.$Name = $Value if ($PSCmdlet.ShouldProcess('ContextSetting', 'Set')) { Set-Context -ID $script:GitHub.Config.ID -Context $script:GitHub.Config } @@ -44,6 +44,6 @@ function Set-GitHubConfig { } end { - Write-Verbose "[$commandName] - End" + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Emojis/Get-GitHubEmoji.ps1 b/src/functions/public/Emojis/Get-GitHubEmoji.ps1 index 19696c7c..21183390 100644 --- a/src/functions/public/Emojis/Get-GitHubEmoji.ps1 +++ b/src/functions/public/Emojis/Get-GitHubEmoji.ps1 @@ -32,23 +32,38 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - $inputObject = @{ - Context = $Context - APIEndpoint = '/emojis' - Method = 'GET' + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } - $response = Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response - } + process { + try { + $inputObject = @{ + Context = $Context + APIEndpoint = '/emojis' + Method = 'GET' + } + + $response = Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } - if (Test-Path -Path $Destination) { - $response.PSObject.Properties | ForEach-Object -ThrottleLimit ([System.Environment]::ProcessorCount) -Parallel { - Invoke-WebRequest -Uri $_.Value -OutFile "$using:Destination/$($_.Name).png" + if (Test-Path -Path $Destination) { + $response.PSObject.Properties | ForEach-Object -ThrottleLimit ([System.Environment]::ProcessorCount) -Parallel { + Invoke-WebRequest -Uri $_.Value -OutFile "$using:Destination/$($_.Name).png" + } + } else { + $response + } + } catch { + throw $_ } - } else { - $response + } + + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Enterprise/Get-GitHubEnterpriseInstallableOrganization.ps1 b/src/functions/public/Enterprise/Get-GitHubEnterpriseInstallableOrganization.ps1 index 1b6ec8d4..0248a14a 100644 --- a/src/functions/public/Enterprise/Get-GitHubEnterpriseInstallableOrganization.ps1 +++ b/src/functions/public/Enterprise/Get-GitHubEnterpriseInstallableOrganization.ps1 @@ -24,20 +24,34 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - if ([string]::IsNullOrEmpty($Enterprise)) { - $Enterprise = $Context.Enterprise + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + if ([string]::IsNullOrEmpty($Enterprise)) { + $Enterprise = $Context.Enterprise + } + Write-Debug "Enterprise : [$($Context.Enterprise)]" } - Write-Debug "Enterprise : [$($Context.Enterprise)]" - $inputObject = @{ - Context = $Context - APIEndpoint = "/enterprises/$Enterprise/apps/installable_organizations" - Method = 'GET' + process { + try { + $inputObject = @{ + Context = $Context + APIEndpoint = "/enterprises/$Enterprise/apps/installable_organizations" + Method = 'GET' + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Enterprise/Get-GitHubEnterpriseOrganization.ps1 b/src/functions/public/Enterprise/Get-GitHubEnterpriseOrganization.ps1 index 8d269dd7..025cf9e7 100644 --- a/src/functions/public/Enterprise/Get-GitHubEnterpriseOrganization.ps1 +++ b/src/functions/public/Enterprise/Get-GitHubEnterpriseOrganization.ps1 @@ -20,15 +20,20 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - if ([string]::IsNullOrEmpty($Enterprise)) { - $Enterprise = $Context.Enterprise + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + if ([string]::IsNullOrEmpty($Enterprise)) { + $Enterprise = $Context.Enterprise + } + Write-Debug "Enterprise : [$($Context.Enterprise)]" } - Write-Debug "Enterprise : [$($Context.Enterprise)]" - # Define GraphQL query - $query = @" + process { + try { + $query = @" query(`$enterpriseSlug: String!, `$first: Int = 100, `$after: String) { enterprise(slug: `$enterpriseSlug) { organizations(first: `$first, after: `$after) { @@ -47,34 +52,42 @@ query(`$enterpriseSlug: String!, `$first: Int = 100, `$after: String) { } "@ - # Initialize pagination variables - $variables = @{ - 'enterpriseSlug' = $Enterprise - 'first' = 100 - 'after' = $null - } - $allOrgs = @() + # Initialize pagination variables + $variables = @{ + 'enterpriseSlug' = $Enterprise + 'first' = 100 + 'after' = $null + } + $allOrgs = @() - # Loop through pages to retrieve all organizations - do { - $response = Invoke-GitHubGraphQLQuery -Query $query -Variables $variables -Context $Context - # Check for errors - if ($response.errors) { - Write-Error "Error: $($response.errors[0].message)" - break - } + # Loop through pages to retrieve all organizations + do { + $response = Invoke-GitHubGraphQLQuery -Query $query -Variables $variables -Context $Context + # Check for errors + if ($response.errors) { + Write-Error "Error: $($response.errors[0].message)" + break + } - # Extract organization names and add to the list - foreach ($org in $response.data.enterprise.organizations.edges) { - $allOrgs += $org.node.name - } + # Extract organization names and add to the list + foreach ($org in $response.data.enterprise.organizations.edges) { + $allOrgs += $org.node.name + } - # Update pagination cursor - $pageInfo = $response.data.enterprise.organizations.pageInfo - $variables.after = $pageInfo.endCursor + # Update pagination cursor + $pageInfo = $response.data.enterprise.organizations.pageInfo + $variables.after = $pageInfo.endCursor - } while ($pageInfo.hasNextPage -eq $true) + } while ($pageInfo.hasNextPage -eq $true) - # Output the list of organization names - $allOrgs | ForEach-Object { Write-Output $_ } + # Output the list of organization names + $allOrgs | ForEach-Object { Write-Output $_ } + } catch { + throw $_ + } + } + + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/public/Enterprise/Install-GitHubAppOnEnterpriseOrganization.ps1 b/src/functions/public/Enterprise/Install-GitHubAppOnEnterpriseOrganization.ps1 index db88f80f..acf89b1d 100644 --- a/src/functions/public/Enterprise/Install-GitHubAppOnEnterpriseOrganization.ps1 +++ b/src/functions/public/Enterprise/Install-GitHubAppOnEnterpriseOrganization.ps1 @@ -42,28 +42,41 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - if ([string]::IsNullOrEmpty($Enterprise)) { - $Enterprise = $Context.Enterprise + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + if ([string]::IsNullOrEmpty($Enterprise)) { + $Enterprise = $Context.Enterprise + } + Write-Debug "Enterprise : [$($Context.Enterprise)]" } - Write-Debug "Enterprise : [$($Context.Enterprise)]" - $body = @{ - client_id = $ClientID - repository_selection = $RepositorySelection - repositories = $Repositories - } - $body | Remove-HashtableEntry -NullOrEmptyValues + process { + try { + $body = @{ + client_id = $ClientID + repository_selection = $RepositorySelection + repositories = $Repositories + } + + $inputObject = @{ + Context = $Context + APIEndpoint = "/enterprises/$Enterprise/apps/organizations/$Organization/installations" + Method = 'Post' + Body = $body + } - $inputObject = @{ - Context = $Context - APIEndpoint = "/enterprises/$Enterprise/apps/organizations/$Organization/installations" - Method = 'Post' - Body = $body + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Git/Get-GitHubGitConfig.ps1 b/src/functions/public/Git/Get-GitHubGitConfig.ps1 index e2b9e148..8aba0ec8 100644 --- a/src/functions/public/Git/Get-GitHubGitConfig.ps1 +++ b/src/functions/public/Git/Get-GitHubGitConfig.ps1 @@ -15,22 +15,34 @@ [CmdletBinding()] param() - $commandName = $MyInvocation.MyCommand.Name - Write-Verbose "[$commandName] - Start" - - $gitExists = Get-Command -Name 'git' -ErrorAction SilentlyContinue - if (-not $gitExists) { - throw 'Git is not installed. Please install Git before running this command.' + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context } - git config --local --list | ForEach-Object { - ( - [pscustomobject]@{ - Name = $_.Split('=')[0] - Value = $_.Split('=')[1] + process { + try { + + $gitExists = Get-Command -Name 'git' -ErrorAction SilentlyContinue + if (-not $gitExists) { + throw 'Git is not installed. Please install Git before running this command.' } - ) + + git config --local --list | ForEach-Object { + ( + [pscustomobject]@{ + Name = $_.Split('=')[0] + Value = $_.Split('=')[1] + } + ) + } + } catch { + throw $_ + } } - Write-Verbose "[$commandName] - End" + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/public/Git/Set-GitHubGitConfig.ps1 b/src/functions/public/Git/Set-GitHubGitConfig.ps1 index ef13448f..8cd971ec 100644 --- a/src/functions/public/Git/Set-GitHubGitConfig.ps1 +++ b/src/functions/public/Git/Set-GitHubGitConfig.ps1 @@ -26,34 +26,38 @@ begin { $commandName = $MyInvocation.MyCommand.Name - Write-Verbose "[$commandName] - Start" + Write-Debug "[$commandName] - Start" $Context = Resolve-GitHubContext -Context $Context } process { - $gitExists = Get-Command -Name 'git' -ErrorAction SilentlyContinue - if (-not $gitExists) { - throw 'Git is not installed. Please install Git before running this command.' - } - - $username = $Context.UserName - $id = $Context.DatabaseID - $token = $Context.Token | ConvertFrom-SecureString -AsPlainText - $hostName = $Context.HostName - - if ($PSCmdlet.ShouldProcess("$Name", 'Set Git configuration')) { - Write-Verbose "git config --local user.name '$username'" - git config --local user.name "$username" - - Write-Verbose "git config --local user.email '$id+$username@users.noreply.github.com'" - git config --local user.email "$id+$username@users.noreply.github.com" - - Write-Verbose "git config --local 'url.https://oauth2:$token@$hostName.insteadOf' 'https://$hostName'" - git config --local "url.https://oauth2:$token@$hostName.insteadOf" "https://$hostName" + try { + $gitExists = Get-Command -Name 'git' -ErrorAction SilentlyContinue + if (-not $gitExists) { + throw 'Git is not installed. Please install Git before running this command.' + } + + $username = $Context.UserName + $id = $Context.DatabaseID + $token = $Context.Token | ConvertFrom-SecureString -AsPlainText + $hostName = $Context.HostName + + if ($PSCmdlet.ShouldProcess("$Name", 'Set Git configuration')) { + Write-Verbose "git config --local user.name '$username'" + git config --local user.name "$username" + + Write-Verbose "git config --local user.email '$id+$username@users.noreply.github.com'" + git config --local user.email "$id+$username@users.noreply.github.com" + + Write-Verbose "git config --local 'url.https://oauth2:$token@$hostName.insteadOf' 'https://$hostName'" + git config --local "url.https://oauth2:$token@$hostName.insteadOf" "https://$hostName" + } + } catch { + throw $_ } } end { - Write-Verbose "[$commandName] - End" + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Gitignore/Get-GitHubGitignore.ps1 b/src/functions/public/Gitignore/Get-GitHubGitignore.ps1 index 4a1a3ad5..7f34aa6c 100644 --- a/src/functions/public/Gitignore/Get-GitHubGitignore.ps1 +++ b/src/functions/public/Gitignore/Get-GitHubGitignore.ps1 @@ -49,18 +49,33 @@ filter Get-GitHubGitignore { } begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + if ([string]::IsNullOrEmpty($Enterprise)) { + $Enterprise = $Context.Enterprise + } + Write-Debug "Enterprise : [$($Context.Enterprise)]" } process { - $Name = $PSBoundParameters['Name'] - switch ($PSCmdlet.ParameterSetName) { - 'List' { - Get-GitHubGitignoreList -Context $Context - } - 'Name' { - Get-GitHubGitignoreByName -Name $Name -Context $Context + try { + $Name = $PSBoundParameters['Name'] + switch ($PSCmdlet.ParameterSetName) { + 'List' { + Get-GitHubGitignoreList -Context $Context + } + 'Name' { + Get-GitHubGitignoreByName -Name $Name -Context $Context + } } + } catch { + throw $_ } } + + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/public/GraphQL/Invoke-GitHubGraphQLQuery.ps1 b/src/functions/public/GraphQL/Invoke-GitHubGraphQLQuery.ps1 index e6050a83..66069889 100644 --- a/src/functions/public/GraphQL/Invoke-GitHubGraphQLQuery.ps1 +++ b/src/functions/public/GraphQL/Invoke-GitHubGraphQLQuery.ps1 @@ -27,27 +27,32 @@ begin { $commandName = $MyInvocation.MyCommand.Name - Write-Verbose "[$commandName] - Start" + Write-Debug "[$commandName] - Start" $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } process { - $inputObject = @{ - Context = $Context - APIEndpoint = '/graphql' - Method = 'Post' - Body = @{ - 'query' = $Query - 'variables' = $Variables - } | ConvertTo-Json - } - - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + try { + $inputObject = @{ + Context = $Context + APIEndpoint = '/graphql' + Method = 'Post' + Body = @{ + 'query' = $Query + 'variables' = $Variables + } | ConvertTo-Json + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ } } end { - Write-Verbose "[$commandName] - End" + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/License/Get-GitHubLicense.ps1 b/src/functions/public/License/Get-GitHubLicense.ps1 index 14bf025b..34f5ce2e 100644 --- a/src/functions/public/License/Get-GitHubLicense.ps1 +++ b/src/functions/public/License/Get-GitHubLicense.ps1 @@ -67,8 +67,10 @@ filter Get-GitHubLicense { } begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" $Context = Resolve-GitHubContext -Context $Context - + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } @@ -81,17 +83,25 @@ filter Get-GitHubLicense { } process { - $Name = $PSBoundParameters['Name'] - switch ($PSCmdlet.ParameterSetName) { - 'List' { - Get-GitHubLicenseList -Context $Context - } - 'Name' { - Get-GitHubLicenseByName -Name $Name -Context $Context - } - 'Repository' { - Get-GitHubRepositoryLicense -Owner $Owner -Repo $Repo -Context $Context + try { + $Name = $PSBoundParameters['Name'] + switch ($PSCmdlet.ParameterSetName) { + 'List' { + Get-GitHubLicenseList -Context $Context + } + 'Name' { + Get-GitHubLicenseByName -Name $Name -Context $Context + } + 'Repository' { + Get-GitHubRepositoryLicense -Owner $Owner -Repo $Repo -Context $Context + } } + } catch { + throw $_ } } + + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/public/Markdown/Get-GitHubMarkdown.ps1 b/src/functions/public/Markdown/Get-GitHubMarkdown.ps1 index 03842919..ffbe4dec 100644 --- a/src/functions/public/Markdown/Get-GitHubMarkdown.ps1 +++ b/src/functions/public/Markdown/Get-GitHubMarkdown.ps1 @@ -1,10 +1,24 @@ filter Get-GitHubMarkdown { <# + .SYNOPSIS + Render a Markdown document + + .DESCRIPTION + Converts markdown to html + + .EXAMPLE + Get-GitHubMarkdown -Text "Hello **world**" + "

Hello world

" + + Renders the markdown text "Hello **world**" to HTML. + .NOTES [Render a Markdown document](https://docs.github.com/en/rest/markdown/markdown#render-a-markdown-document) #> + [OutputType([string])] [CmdletBinding()] param( + # The Markdown text to render in HTML. [Parameter( Mandatory, ValueFromPipeline, @@ -12,11 +26,13 @@ )] [switch] $Text, + # The rendering mode. [Parameter()] [ValidateSet('markdown', 'gfm')] [string] $Mode, - #TODO: Need docs + # The repository context to use when creating references in `gfm` mode. For example, setting `context` to `octo-org/octo-repo` will change the + # text `#42` into an HTML link to issue 42 in the `octo-org/octo-repo` repository. [Parameter()] [string] $RepoContext, @@ -26,23 +42,37 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - $body = @{ - context = $RepoContext - mode = $Mode - text = $Text + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } - $inputObject = @{ - Context = $Context - APIEndpoint = '/markdown' - Method = 'POST' - Body = $body - } + process { + try { + $body = @{ + context = $RepoContext + mode = $Mode + text = $Text + } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + $inputObject = @{ + Context = $Context + APIEndpoint = '/markdown' + Method = 'POST' + Body = $body + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/public/Markdown/Get-GitHubMarkdownRaw.ps1 b/src/functions/public/Markdown/Get-GitHubMarkdownRaw.ps1 index 77a5817b..638d621f 100644 --- a/src/functions/public/Markdown/Get-GitHubMarkdownRaw.ps1 +++ b/src/functions/public/Markdown/Get-GitHubMarkdownRaw.ps1 @@ -1,11 +1,25 @@ filter Get-GitHubMarkdownRaw { <# + .SYNOPSIS + Render a Markdown document in raw mode + + .DESCRIPTION + You must send Markdown as plain text (using a `Content-Type` header of `text/plain` or `text/x-markdown`) to this endpoint, rather than using + JSON format. In raw mode, [GitHub Flavored Markdown](https://github.github.com/gfm/) is not supported and Markdown will be rendered in plain + format like a README.md file. Markdown content must be 400 KB or less. + + .EXAMPLE + Get-GitHubMarkdownRaw -Text 'Hello, world!' + "

Hello world

" + + Render the Markdown text 'Hello, world!' in raw mode. + .NOTES [Render a Markdown document in raw mode](https://docs.github.com/rest/reference/meta#github-api-root) #> [CmdletBinding()] param( - #TODO: Need docs + # The Markdown text to render in HTML. [Parameter()] [string] $Text, @@ -15,17 +29,32 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + } + + process { + try { + $inputObject = @{ + Context = $Context + APIEndpoint = '/markdown/raw' + ContentType = 'text/plain' + Body = $Text + Method = 'POST' + } - $inputObject = @{ - Context = $Context - APIEndpoint = '/markdown/raw' - ContentType = 'text/plain' - Body = $Text - Method = 'POST' + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Meta/Get-GitHubApiVersion.ps1 b/src/functions/public/Meta/Get-GitHubApiVersion.ps1 index baedc6a3..046bcb2d 100644 --- a/src/functions/public/Meta/Get-GitHubApiVersion.ps1 +++ b/src/functions/public/Meta/Get-GitHubApiVersion.ps1 @@ -25,23 +25,28 @@ begin { $commandName = $MyInvocation.MyCommand.Name - Write-Verbose "[$commandName] - Start" + Write-Debug "[$commandName] - Start" $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } process { - $inputObject = @{ - Context = $Context - ApiEndpoint = '/versions' - Method = 'GET' - } - - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + try { + $inputObject = @{ + Context = $Context + ApiEndpoint = '/versions' + Method = 'GET' + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ } } end { - Write-Verbose "[$commandName] - End" + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Meta/Get-GitHubMeta.ps1 b/src/functions/public/Meta/Get-GitHubMeta.ps1 index 25ac1ca2..c4059246 100644 --- a/src/functions/public/Meta/Get-GitHubMeta.ps1 +++ b/src/functions/public/Meta/Get-GitHubMeta.ps1 @@ -33,23 +33,28 @@ begin { $commandName = $MyInvocation.MyCommand.Name - Write-Verbose "[$commandName] - Start" + Write-Debug "[$commandName] - Start" $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } process { - $inputObject = @{ - Context = $Context - ApiEndpoint = '/meta' - Method = 'GET' - } - - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + try { + $inputObject = @{ + Context = $Context + ApiEndpoint = '/meta' + Method = 'GET' + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ } } end { - Write-Verbose "[$commandName] - End" + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Meta/Get-GitHubOctocat.ps1 b/src/functions/public/Meta/Get-GitHubOctocat.ps1 index 1f8f3120..749873b8 100644 --- a/src/functions/public/Meta/Get-GitHubOctocat.ps1 +++ b/src/functions/public/Meta/Get-GitHubOctocat.ps1 @@ -36,28 +36,33 @@ begin { $commandName = $MyInvocation.MyCommand.Name - Write-Verbose "[$commandName] - Start" + Write-Debug "[$commandName] - Start" $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } process { - $body = @{ - s = $S - } + try { + $body = @{ + s = $S + } - $inputObject = @{ - Context = $Context - APIEndpoint = '/octocat' - Method = 'GET' - Body = $body - } + $inputObject = @{ + Context = $Context + APIEndpoint = '/octocat' + Method = 'GET' + Body = $body + } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ } } end { - Write-Verbose "[$commandName] - End" + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Meta/Get-GitHubRoot.ps1 b/src/functions/public/Meta/Get-GitHubRoot.ps1 index 9a1129a5..df459c00 100644 --- a/src/functions/public/Meta/Get-GitHubRoot.ps1 +++ b/src/functions/public/Meta/Get-GitHubRoot.ps1 @@ -24,23 +24,28 @@ begin { $commandName = $MyInvocation.MyCommand.Name - Write-Verbose "[$commandName] - Start" + Write-Debug "[$commandName] - Start" $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } process { - $inputObject = @{ - Context = $Context - APIEndpoint = '/' - Method = 'GET' - } - - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + try { + $inputObject = @{ + Context = $Context + APIEndpoint = '/' + Method = 'GET' + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ } } end { - Write-Verbose "[$commandName] - End" + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Meta/Get-GitHubZen.ps1 b/src/functions/public/Meta/Get-GitHubZen.ps1 index 54baf46a..04193834 100644 --- a/src/functions/public/Meta/Get-GitHubZen.ps1 +++ b/src/functions/public/Meta/Get-GitHubZen.ps1 @@ -24,23 +24,28 @@ begin { $commandName = $MyInvocation.MyCommand.Name - Write-Verbose "[$commandName] - Start" + Write-Debug "[$commandName] - Start" $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } process { - $inputObject = @{ - Context = $Context - APIEndpoint = '/zen' - Method = 'GET' - } - - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + try { + $inputObject = @{ + Context = $Context + APIEndpoint = '/zen' + Method = 'GET' + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ } } end { - Write-Verbose "[$commandName] - End" + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Organization/Get-GitHubOrganization.ps1 b/src/functions/public/Organization/Get-GitHubOrganization.ps1 index b28609c6..79d560c4 100644 --- a/src/functions/public/Organization/Get-GitHubOrganization.ps1 +++ b/src/functions/public/Organization/Get-GitHubOrganization.ps1 @@ -79,25 +79,41 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - if ([string]::IsNullOrEmpty($Owner)) { - $Organization = $Context.Owner + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" } - Write-Debug "Organization : [$($Context.Owner)]" - switch ($PSCmdlet.ParameterSetName) { - '__DefaultSet' { - Get-GitHubMyOrganization -PerPage $PerPage -Context $Context | Get-GitHubOrganizationByName -Context $Context - } - 'NamedOrg' { - Get-GitHubOrganizationByName -Organization $Organization -Context $Context - } - 'NamedUser' { - Get-GitHubUserOrganization -Username $Username -Context $Context - } - 'AllOrg' { - Get-GitHubAllOrganization -Since $Since -PerPage $PerPage -Context $Context + process { + try { + + switch ($PSCmdlet.ParameterSetName) { + '__DefaultSet' { + Get-GitHubMyOrganization -PerPage $PerPage -Context $Context | Get-GitHubOrganizationByName -Context $Context + } + 'NamedOrg' { + Get-GitHubOrganizationByName -Organization $Organization -Context $Context + } + 'NamedUser' { + Get-GitHubUserOrganization -Username $Username -Context $Context + } + 'AllOrg' { + Get-GitHubAllOrganization -Since $Since -PerPage $PerPage -Context $Context + } + } + } catch { + throw $_ } } + + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/public/Organization/Get-GitHubOrganizationAppInstallation.ps1 b/src/functions/public/Organization/Get-GitHubOrganizationAppInstallation.ps1 index 5c373d02..42ae2687 100644 --- a/src/functions/public/Organization/Get-GitHubOrganizationAppInstallation.ps1 +++ b/src/functions/public/Organization/Get-GitHubOrganizationAppInstallation.ps1 @@ -41,25 +41,40 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT - if ([string]::IsNullOrEmpty($Owner)) { - $Organization = $Context.Owner + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" } - Write-Debug "Organization : [$($Context.Owner)]" - $body = @{ - per_page = $PerPage - } + process { + try { + $body = @{ + per_page = $PerPage + } + + $inputObject = @{ + Context = $Context + APIEndpoint = "/orgs/$Organization/installations" + Method = 'GET' + Body = $body + } - $inputObject = @{ - Context = $Context - APIEndpoint = "/orgs/$Organization/installations" - Method = 'GET' - Body = $body + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response.installations + } + } catch { + throw $_ + } } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response.installations + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Organization/Members/Get-GitHubOrganizationMember.ps1 b/src/functions/public/Organization/Members/Get-GitHubOrganizationMember.ps1 index 24f6ef5c..4a553d4c 100644 --- a/src/functions/public/Organization/Members/Get-GitHubOrganizationMember.ps1 +++ b/src/functions/public/Organization/Members/Get-GitHubOrganizationMember.ps1 @@ -41,27 +41,42 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT - if ([string]::IsNullOrEmpty($Owner)) { - $Organization = $Context.Owner + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" } - Write-Debug "Organization : [$($Context.Owner)]" - $body = @{ - filter = $Filter - role = $Role - per_page = $PerPage - } + process { + try { + $body = @{ + filter = $Filter + role = $Role + per_page = $PerPage + } + + $inputObject = @{ + Context = $Context + Body = $body + Method = 'Get' + APIEndpoint = "/orgs/$Organization/members" + } - $inputObject = @{ - Context = $Context - Body = $body - Method = 'Get' - APIEndpoint = "/orgs/$Organization/members" + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Organization/Members/Get-GitHubOrganizationPendingInvitation.ps1 b/src/functions/public/Organization/Members/Get-GitHubOrganizationPendingInvitation.ps1 index e8f6baec..8209f92f 100644 --- a/src/functions/public/Organization/Members/Get-GitHubOrganizationPendingInvitation.ps1 +++ b/src/functions/public/Organization/Members/Get-GitHubOrganizationPendingInvitation.ps1 @@ -40,27 +40,42 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT - if ([string]::IsNullOrEmpty($Owner)) { - $Organization = $Context.Owner + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" } - Write-Debug "Organization : [$($Context.Owner)]" - $body = @{ - role = $Role - invitation_source = $InvitationSource - per_page = $PerPage - } + process { + try { + $body = @{ + role = $Role + invitation_source = $InvitationSource + per_page = $PerPage + } + + $inputObject = @{ + Context = $Context + Body = $body + Method = 'Get' + APIEndpoint = "/orgs/$Organization/invitations" + } - $inputObject = @{ - Context = $Context - Body = $body - Method = 'Get' - APIEndpoint = "/orgs/$Organization/invitations" + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Organization/Members/New-GitHubOrganizationInvitation.ps1 b/src/functions/public/Organization/Members/New-GitHubOrganizationInvitation.ps1 index 8de6e35b..eff5116b 100644 --- a/src/functions/public/Organization/Members/New-GitHubOrganizationInvitation.ps1 +++ b/src/functions/public/Organization/Members/New-GitHubOrganizationInvitation.ps1 @@ -59,33 +59,46 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT - if ([string]::IsNullOrEmpty($Owner)) { - $Organization = $Context.Owner + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" } - Write-Debug "Organization : [$($Context.Owner)]" - - $body = @{ - invitee_id = $InviteeID - email = $Email - role = $Role - team_ids = $TeamIDs - } + process { + try { + $body = @{ + invitee_id = $InviteeID + email = $Email + role = $Role + team_ids = $TeamIDs + } + $body | Remove-HashtableEntry -NullOrEmptyValues - $body | Remove-HashtableEntry -NullOrEmptyValues + $inputObject = @{ + Context = $Context + Body = $body + Method = 'post' + APIEndpoint = "/orgs/$Organization/invitations" + } - $inputObject = @{ - Context = $Context - Body = $body - Method = 'post' - APIEndpoint = "/orgs/$Organization/invitations" + if ($PSCmdlet.ShouldProcess("$InviteeID$Email to organization $Organization", 'Invite')) { + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } + } catch { + throw $_ + } } - if ($PSCmdlet.ShouldProcess("$InviteeID$Email to organization $Organization", 'Invite')) { - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response - } + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Organization/Remove-GitHubOrganization.ps1 b/src/functions/public/Organization/Remove-GitHubOrganization.ps1 index 9755e0a9..6ed2bf9a 100644 --- a/src/functions/public/Organization/Remove-GitHubOrganization.ps1 +++ b/src/functions/public/Organization/Remove-GitHubOrganization.ps1 @@ -37,23 +37,37 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT - if ([string]::IsNullOrEmpty($Owner)) { - $Organization = $Context.Owner + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" } - Write-Debug "Organization : [$($Context.Owner)]" - $inputObject = @{ - Context = $Context - APIEndpoint = "/orgs/$Organization" - Method = 'DELETE' - } + process { + try { + $inputObject = @{ + Context = $Context + APIEndpoint = "/orgs/$Organization" + Method = 'DELETE' + } - if ($PSCmdlet.ShouldProcess("organization [$Organization]", 'Delete')) { - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + if ($PSCmdlet.ShouldProcess("organization [$Organization]", 'Delete')) { + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } + } catch { + throw $_ } } + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/public/Organization/Set-GitHubOrganization.ps1 b/src/functions/public/Organization/Set-GitHubOrganization.ps1 index e79e4038..8aa4aec6 100644 --- a/src/functions/public/Organization/Set-GitHubOrganization.ps1 +++ b/src/functions/public/Organization/Set-GitHubOrganization.ps1 @@ -36,6 +36,10 @@ #> [OutputType([pscustomobject])] [CmdletBinding(SupportsShouldProcess)] + [Diagnostics.CodeAnalysis.SuppressMessageAttribute( + 'PSAvoidLongLines', '', + Justification = 'Long parameter names' + )] param( # The organization name. The name is not case sensitive. [Parameter( @@ -223,27 +227,70 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT - if ([string]::IsNullOrEmpty($Owner)) { - $Organization = $Context.Owner - } - Write-Debug "Organization : [$($Context.Owner)]" - - $body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case - Remove-HashtableEntry -Hashtable $body -RemoveNames 'organization_name' - - $inputObject = @{ - Context = $Context - APIEndpoint = "/orgs/$Organization" - Method = 'PATCH' - Body = $body + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" } - if ($PSCmdlet.ShouldProcess("organization [$Organization]", 'Set')) { - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + process { + try { + $body = @{ + billing_email = $BillingEmail + company = $Company + email = $Email + twitter_username = $TwitterUsername + location = $Location + name = $Name + description = $Description + has_organization_projects = $HasOrganizationProjects + has_repository_projects = $HasRepositoryProjects + default_repository_permission = $DefaultRepositoryPermission + members_can_create_repositories = $MembersCanCreateRepositories ? $MembersCanCreateRepositories : $true + members_can_create_internal_repositories = $MembersCanCreateInternalRepositories + members_can_create_private_repositories = $MembersCanCreatePrivateRepositories + members_can_create_public_repositories = $MembersCanCreatePublicRepositories + members_allowed_repository_creation_type = $MembersAllowedRepositoryCreationType + members_can_create_pages = $MembersCanCreatePages ? $MembersCanCreatePages : $true + members_can_create_public_pages = $MembersCanCreatePublicPages ? $MembersCanCreatePublicPages : $true + members_can_create_private_pages = $MembersCanCreatePrivatePages ? $MembersCanCreatePrivatePages : $true + members_can_fork_private_repositories = $MembersCanForkPrivateRepositories ? $MembersCanForkPrivateRepositories : $false + web_commit_signoff_required = $WebCommitSignoffRequired ? $WebCommitSignoffRequired : $false + blog = $Blog + advanced_security_enabled_for_new_repositories = $AdvancedSecurityEnabledForNewRepositories ? $AdvancedSecurityEnabledForNewRepositories : $false + dependabot_alerts_enabled_for_new_repositories = $DependabotAlertsEnabledForNewRepositories ? $DependabotAlertsEnabledForNewRepositories : $false + dependabot_security_updates_enabled_for_new_repositories = $DependabotSecurityUpdatesEnabledForNewRepositories ? $DependabotSecurityUpdatesEnabledForNewRepositories : $false + dependency_graph_enabled_for_new_repositories = $DependencyGraphEnabledForNewRepositories ? $DependencyGraphEnabledForNewRepositories : $false + secret_scanning_enabled_for_new_repositories = $SecretScanningEnabledForNewRepositories ? $SecretScanningEnabledForNewRepositories : $false + secret_scanning_push_protection_enabled_for_new_repositories = $SecretScanningPushProtectionEnabledForNewRepositories ? $SecretScanningPushProtectionEnabledForNewRepositories : $false + secret_scanning_push_protection_custom_link_enabled = $SecretScanningPushProtectionCustomLinkEnabled ? $SecretScanningPushProtectionCustomLinkEnabled : $false + secret_scanning_push_protection_custom_link = $SecretScanningPushProtectionCustomLink + } + + $inputObject = @{ + Context = $Context + APIEndpoint = "/orgs/$Organization" + Method = 'PATCH' + Body = $body + } + + if ($PSCmdlet.ShouldProcess("organization [$Organization]", 'Set')) { + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } + } catch { + throw $_ } } + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/public/Organization/Set-GitHubOrganizationSecurityFeature.ps1 b/src/functions/public/Organization/Set-GitHubOrganizationSecurityFeature.ps1 index f30c45e1..38532552 100644 --- a/src/functions/public/Organization/Set-GitHubOrganizationSecurityFeature.ps1 +++ b/src/functions/public/Organization/Set-GitHubOrganizationSecurityFeature.ps1 @@ -74,27 +74,42 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - if ([string]::IsNullOrEmpty($Owner)) { - $Organization = $Context.Owner - } - Write-Debug "Organization : [$($Context.Owner)]" - - $body = @{ - query_suite = $QuerySuite + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" } - $inputObject = @{ - Context = $Context - APIEndpoint = "/orgs/$Organization/$SecurityProduct/$Enablement" - Method = 'POST' - Body = $body + process { + try { + $body = @{ + query_suite = $QuerySuite + } + + $inputObject = @{ + Context = $Context + APIEndpoint = "/orgs/$Organization/$SecurityProduct/$Enablement" + Method = 'POST' + Body = $body + } + + if ($PSCmdlet.ShouldProcess("security feature [$SecurityProduct] on organization [$Organization]", 'Set')) { + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } + } catch { + throw $_ + } } - if ($PSCmdlet.ShouldProcess("security feature [$SecurityProduct] on organization [$Organization]", 'Set')) { - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response - } + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Rate-Limit/Get-GitHubRateLimit.ps1 b/src/functions/public/Rate-Limit/Get-GitHubRateLimit.ps1 index 19e587f6..9c08765e 100644 --- a/src/functions/public/Rate-Limit/Get-GitHubRateLimit.ps1 +++ b/src/functions/public/Rate-Limit/Get-GitHubRateLimit.ps1 @@ -40,16 +40,30 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - $inputObject = @{ - Context = $Context - APIEndpoint = '/rate_limit' - Method = 'GET' + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response.Resources + process { + try { + $inputObject = @{ + Context = $Context + APIEndpoint = '/rate_limit' + Method = 'GET' + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response.Resources + } + } catch { + throw $_ + } } + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/public/Releases/Assets/Add-GitHubReleaseAsset.ps1 b/src/functions/public/Releases/Assets/Add-GitHubReleaseAsset.ps1 index cb35c76d..c0de009f 100644 --- a/src/functions/public/Releases/Assets/Add-GitHubReleaseAsset.ps1 +++ b/src/functions/public/Releases/Assets/Add-GitHubReleaseAsset.ps1 @@ -83,72 +83,79 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner - } - Write-Debug "Owner : [$($Context.Owner)]" - - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo - } - Write-Debug "Repo : [$($Context.Repo)]" - - # If name is not provided, use the name of the file - if (!$Name) { - $Name = (Get-Item $FilePath).Name - } - - # If label is not provided, use the name of the file - if (!$Label) { - $Label = (Get-Item $FilePath).Name - } + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" - # If content type is not provided, use the file extension - if (!$ContentType) { - $ContentType = switch ((Get-Item $FilePath).Extension) { - '.zip' { 'application/zip' } - '.tar' { 'application/x-tar' } - '.gz' { 'application/gzip' } - '.bz2' { 'application/x-bzip2' } - '.xz' { 'application/x-xz' } - '.7z' { 'application/x-7z-compressed' } - '.rar' { 'application/vnd.rar' } - '.tar.gz' { 'application/gzip' } - '.tgz' { 'application/gzip' } - '.tar.bz2' { 'application/x-bzip2' } - '.tar.xz' { 'application/x-xz' } - '.tar.7z' { 'application/x-7z-compressed' } - '.tar.rar' { 'application/vnd.rar' } - '.png' { 'image/png' } - '.json' { 'application/json' } - '.txt' { 'text/plain' } - '.md' { 'text/markdown' } - '.html' { 'text/html' } - default { 'application/octet-stream' } + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo } + Write-Debug "Repo : [$($Context.Repo)]" } - $body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case - Remove-HashtableEntry -Hashtable $body -RemoveNames 'Owner', 'Repo', 'ID', 'FilePath' - - $body['name'] = $Name - $body['label'] = $Label - - Remove-HashtableEntry -Hashtable $body -NullOrEmptyValues - - $release = Get-GitHubRelease -Owner $Owner -Repo $Repo -ID $ID - $uploadURI = $release.upload_url -replace '{\?name,label}', "?name=$($Name)&label=$($Label)" - - $inputObject = @{ - URI = $uploadURI - Method = 'POST' - ContentType = $ContentType - UploadFilePath = $FilePath + process { + try { + # If name is not provided, use the name of the file + if (!$Name) { + $Name = (Get-Item $FilePath).Name + } + + # If label is not provided, use the name of the file + if (!$Label) { + $Label = (Get-Item $FilePath).Name + } + + # If content type is not provided, use the file extension + if (!$ContentType) { + $ContentType = switch ((Get-Item $FilePath).Extension) { + '.zip' { 'application/zip' } + '.tar' { 'application/x-tar' } + '.gz' { 'application/gzip' } + '.bz2' { 'application/x-bzip2' } + '.xz' { 'application/x-xz' } + '.7z' { 'application/x-7z-compressed' } + '.rar' { 'application/vnd.rar' } + '.tar.gz' { 'application/gzip' } + '.tgz' { 'application/gzip' } + '.tar.bz2' { 'application/x-bzip2' } + '.tar.xz' { 'application/x-xz' } + '.tar.7z' { 'application/x-7z-compressed' } + '.tar.rar' { 'application/vnd.rar' } + '.png' { 'image/png' } + '.json' { 'application/json' } + '.txt' { 'text/plain' } + '.md' { 'text/markdown' } + '.html' { 'text/html' } + default { 'application/octet-stream' } + } + } + + $release = Get-GitHubRelease -Owner $Owner -Repo $Repo -ID $ID + $uploadURI = $release.upload_url -replace '{\?name,label}', "?name=$($Name)&label=$($Label)" + + $inputObject = @{ + URI = $uploadURI + Method = 'POST' + ContentType = $ContentType + UploadFilePath = $FilePath + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Releases/Assets/Get-GitHubReleaseAsset.ps1 b/src/functions/public/Releases/Assets/Get-GitHubReleaseAsset.ps1 index 7964b0bb..41509ce4 100644 --- a/src/functions/public/Releases/Assets/Get-GitHubReleaseAsset.ps1 +++ b/src/functions/public/Releases/Assets/Get-GitHubReleaseAsset.ps1 @@ -53,23 +53,37 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" + + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo + } + Write-Debug "Repo : [$($Context.Repo)]" } - Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo + process { + try { + if ($ReleaseID) { + Get-GitHubReleaseAssetByReleaseID -Owner $Owner -Repo $Repo -ReleaseID $ReleaseID -Context $Context + } + if ($ID) { + Get-GitHubReleaseAssetByID -Owner $Owner -Repo $Repo -ID $ID -Context $Context + } + } catch { + throw $_ + } } - Write-Debug "Repo : [$($Context.Repo)]" - if ($ReleaseID) { - Get-GitHubReleaseAssetByReleaseID -Owner $Owner -Repo $Repo -ReleaseID $ReleaseID -Context $Context - } - if ($ID) { - Get-GitHubReleaseAssetByID -Owner $Owner -Repo $Repo -ID $ID -Context $Context + end { + Write-Debug "[$commandName] - End" } - } diff --git a/src/functions/public/Releases/Assets/Remove-GitHubReleaseAsset.ps1 b/src/functions/public/Releases/Assets/Remove-GitHubReleaseAsset.ps1 index 03e5dc6e..b16109b1 100644 --- a/src/functions/public/Releases/Assets/Remove-GitHubReleaseAsset.ps1 +++ b/src/functions/public/Releases/Assets/Remove-GitHubReleaseAsset.ps1 @@ -36,28 +36,42 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner - } - Write-Debug "Owner : [$($Context.Owner)]" + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo + } + Write-Debug "Repo : [$($Context.Repo)]" } - Write-Debug "Repo : [$($Context.Repo)]" - $inputObject = @{ - Context = $Context - APIEndpoint = "/repos/$Owner/$Repo/releases/assets/$ID" - Method = 'DELETE' - } + process { + try { + $inputObject = @{ + Context = $Context + APIEndpoint = "/repos/$Owner/$Repo/releases/assets/$ID" + Method = 'DELETE' + } - if ($PSCmdlet.ShouldProcess("Asset with ID [$ID] in [$Owner/$Repo]", 'Delete')) { - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + if ($PSCmdlet.ShouldProcess("Asset with ID [$ID] in [$Owner/$Repo]", 'Delete')) { + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } + } catch { + throw $_ } } + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/public/Releases/Assets/Set-GitHubReleaseAsset.ps1 b/src/functions/public/Releases/Assets/Set-GitHubReleaseAsset.ps1 index 7f061994..6e14adfc 100644 --- a/src/functions/public/Releases/Assets/Set-GitHubReleaseAsset.ps1 +++ b/src/functions/public/Releases/Assets/Set-GitHubReleaseAsset.ps1 @@ -49,31 +49,49 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner - } - Write-Debug "Owner : [$($Context.Owner)]" + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo + } + Write-Debug "Repo : [$($Context.Repo)]" } - Write-Debug "Repo : [$($Context.Repo)]" - $body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case - Remove-HashtableEntry -Hashtable $body -RemoveNames 'Owner', 'Repo', 'ID' - - $inputObject = @{ - Context = $Context - APIEndpoint = "/repos/$Owner/$Repo/releases/assets/$ID" - Method = 'PATCH' - Body = $requestBody + process { + try { + $body = @{ + name = $Name + label = $Label + state = $State + } | Remove-HashtableEntry -NullOrEmptyValues + + $inputObject = @{ + Context = $Context + APIEndpoint = "/repos/$Owner/$Repo/releases/assets/$ID" + Method = 'PATCH' + Body = $body + } + + if ($PSCmdlet.ShouldProcess("assets for release with ID [$ID] in [$Owner/$Repo]", 'Set')) { + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } + } catch { + throw $_ + } } - if ($PSCmdlet.ShouldProcess("assets for release with ID [$ID] in [$Owner/$Repo]", 'Set')) { - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response - } + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Releases/Releases/Get-GitHubRelease.ps1 b/src/functions/public/Releases/Releases/Get-GitHubRelease.ps1 index 05e77d8d..bb428b11 100644 --- a/src/functions/public/Releases/Releases/Get-GitHubRelease.ps1 +++ b/src/functions/public/Releases/Releases/Get-GitHubRelease.ps1 @@ -78,30 +78,45 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo + } + Write-Debug "Repo : [$($Context.Repo)]" } - Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo + process { + try { + switch ($PSCmdlet.ParameterSetName) { + 'All' { + Get-GitHubReleaseAll -Owner $Owner -Repo $Repo -PerPage $PerPage -Context $Context + } + 'Latest' { + Get-GitHubReleaseLatest -Owner $Owner -Repo $Repo -Context $Context + } + 'Tag' { + Get-GitHubReleaseByTagName -Owner $Owner -Repo $Repo -Tag $Tag -Context $Context + } + 'ID' { + Get-GitHubReleaseByID -Owner $Owner -Repo $Repo -ID $ID -Context $Context + } + } + } catch { + throw $_ + } } - Write-Debug "Repo : [$($Context.Repo)]" - switch ($PSCmdlet.ParameterSetName) { - 'All' { - Get-GitHubReleaseAll -Owner $Owner -Repo $Repo -PerPage $PerPage -Context $Context - } - 'Latest' { - Get-GitHubReleaseLatest -Owner $Owner -Repo $Repo -Context $Context - } - 'Tag' { - Get-GitHubReleaseByTagName -Owner $Owner -Repo $Repo -Tag $Tag -Context $Context - } - 'ID' { - Get-GitHubReleaseByID -Owner $Owner -Repo $Repo -ID $ID -Context $Context - } + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Releases/Releases/New-GitHubRelease.ps1 b/src/functions/public/Releases/Releases/New-GitHubRelease.ps1 index adff128c..e20ed6a3 100644 --- a/src/functions/public/Releases/Releases/New-GitHubRelease.ps1 +++ b/src/functions/public/Releases/Releases/New-GitHubRelease.ps1 @@ -83,37 +83,55 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner - } - Write-Debug "Owner : [$($Context.Owner)]" + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo - } - Write-Debug "Repo : [$($Context.Repo)]" - - $requestBody = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case - Remove-HashtableEntry -Hashtable $requestBody -RemoveNames 'Owner', 'Repo', 'GenerateReleaseNotes', 'Draft', 'Prerelease' - $requestBody = Join-Object -AsHashtable -Main $requestBody -Overrides @{ - generate_release_notes = $GenerateReleaseNotes.IsPresent - draft = $Draft.IsPresent - prerelease = $Prerelease.IsPresent + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo + } + Write-Debug "Repo : [$($Context.Repo)]" } - Remove-HashtableEntry -Hashtable $requestBody -NullOrEmptyValues - $inputObject = @{ - Context = $Context - APIEndpoint = "/repos/$Owner/$Repo/releases" - Method = 'POST' - Body = $requestBody + process { + try { + $requestBody = @{ + tag_name = $TagName + target_commitish = $TargetCommitish + name = $Name + body = $Body + discussion_category_name = $DiscussionCategoryName + make_latest = $MakeLatest + generate_release_notes = $GenerateReleaseNotes + draft = $Draft + prerelease = $Prerelease + } | Remove-HashtableEntry -NullOrEmptyValues + + $inputObject = @{ + Context = $Context + APIEndpoint = "/repos/$Owner/$Repo/releases" + Method = 'POST' + Body = $requestBody + } + + if ($PSCmdlet.ShouldProcess("$Owner/$Repo", 'Create a release')) { + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } + } catch { + throw $_ + } } - if ($PSCmdlet.ShouldProcess("$Owner/$Repo", 'Create a release')) { - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response - } + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Releases/Releases/New-GitHubReleaseNote.ps1 b/src/functions/public/Releases/Releases/New-GitHubReleaseNote.ps1 index 7645fb3d..ba9c4235 100644 --- a/src/functions/public/Releases/Releases/New-GitHubReleaseNote.ps1 +++ b/src/functions/public/Releases/Releases/New-GitHubReleaseNote.ps1 @@ -97,30 +97,49 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner - } - Write-Debug "Owner : [$($Context.Owner)]" + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo + } + Write-Debug "Repo : [$($Context.Repo)]" } - Write-Debug "Repo : [$($Context.Repo)]" - $body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case - Remove-HashtableEntry -Hashtable $body -RemoveNames 'Owner', 'Repo' - - $inputObject = @{ - APIEndpoint = "/repos/$Owner/$Repo/releases/generate-notes" - Method = 'POST' - Body = $body + process { + try { + $requestBody = @{ + tag_name = $TagName + target_commitish = $TargetCommitish + previous_tag_name = $PreviousTagName + configuration_file_path = $ConfigurationFilePath + } | Remove-HashtableEntry -NullOrEmptyValues + + $inputObject = @{ + APIEndpoint = "/repos/$Owner/$Repo/releases/generate-notes" + Method = 'POST' + Body = $requestBody + } + + if ($PSCmdlet.ShouldProcess("$Owner/$Repo", 'Create release notes')) { + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } + } catch { + throw $_ + } } - if ($PSCmdlet.ShouldProcess("$Owner/$Repo", 'Create release notes')) { - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response - } + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Releases/Releases/Remove-GitHubRelease.ps1 b/src/functions/public/Releases/Releases/Remove-GitHubRelease.ps1 index 00b646db..4e4dc91f 100644 --- a/src/functions/public/Releases/Releases/Remove-GitHubRelease.ps1 +++ b/src/functions/public/Releases/Releases/Remove-GitHubRelease.ps1 @@ -39,28 +39,42 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner - } - Write-Debug "Owner : [$($Context.Owner)]" + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo + } + Write-Debug "Repo : [$($Context.Repo)]" } - Write-Debug "Repo : [$($Context.Repo)]" - $inputObject = @{ - Context = $Context - APIEndpoint = "/repos/$Owner/$Repo/releases/$ID" - Method = 'DELETE' - } + process { + try { + $inputObject = @{ + Context = $Context + APIEndpoint = "/repos/$Owner/$Repo/releases/$ID" + Method = 'DELETE' + } - if ($PSCmdlet.ShouldProcess("Release with ID [$ID] in [$Owner/$Repo]", 'Delete')) { - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + if ($PSCmdlet.ShouldProcess("Release with ID [$ID] in [$Owner/$Repo]", 'Delete')) { + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } + } catch { + throw $_ } } + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/public/Releases/Releases/Set-GitHubRelease.ps1 b/src/functions/public/Releases/Releases/Set-GitHubRelease.ps1 index 29740d94..41ddcd6e 100644 --- a/src/functions/public/Releases/Releases/Set-GitHubRelease.ps1 +++ b/src/functions/public/Releases/Releases/Set-GitHubRelease.ps1 @@ -80,35 +80,54 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner - } - Write-Debug "Owner : [$($Context.Owner)]" - - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo - } - Write-Debug "Repo : [$($Context.Repo)]" + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" - $requestBody = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case - Remove-HashtableEntry -Hashtable $requestBody -RemoveNames 'Owner', 'Repo', 'Draft', 'Prerelease' - $requestBody = Join-Object -AsHashtable -Main $requestBody -Overrides @{ - draft = if ($Draft.IsPresent) { $Draft } else { $false } - prerelease = if ($Prerelease.IsPresent) { $Prerelease } else { $false } + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo + } + Write-Debug "Repo : [$($Context.Repo)]" } - $inputObject = @{ - Context = $Context - APIEndpoint = "/repos/$Owner/$Repo/releases/$ID" - Method = 'PATCH' - Body = $requestBody + process { + try { + $requestBody = @{ + tag_name = $TagName + target_commitish = $TargetCommitish + name = $Name + body = $Body + discussion_category_name = $DiscussionCategoryName + make_latest = $MakeLatest + draft = $Draft + prerelease = $Prerelease + } | Remove-HashtableEntry -NullOrEmptyValues + + $inputObject = @{ + Context = $Context + APIEndpoint = "/repos/$Owner/$Repo/releases/$ID" + Method = 'PATCH' + Body = $requestBody + } + + if ($PSCmdlet.ShouldProcess("release with ID [$ID] in [$Owner/$Repo]", 'Update')) { + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } + } catch { + throw $_ + } } - if ($PSCmdlet.ShouldProcess("release with ID [$ID] in [$Owner/$Repo]", 'Update')) { - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response - } + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Repositories/Autolinks/Get-GitHubRepositoryAutolink.ps1 b/src/functions/public/Repositories/Autolinks/Get-GitHubRepositoryAutolink.ps1 index 43e36a20..025f9299 100644 --- a/src/functions/public/Repositories/Autolinks/Get-GitHubRepositoryAutolink.ps1 +++ b/src/functions/public/Repositories/Autolinks/Get-GitHubRepositoryAutolink.ps1 @@ -49,24 +49,39 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner - } - Write-Debug "Owner : [$($Context.Owner)]" + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo + } + Write-Debug "Repo : [$($Context.Repo)]" } - Write-Debug "Repo : [$($Context.Repo)]" - switch ($PSCmdlet.ParameterSetName) { - 'ById' { - Get-GitHubRepositoryAutolinkById -Owner $Owner -Repo $Repo -ID $AutolinkId -Context $Context - } - default { - Get-GitHubRepositoryAutolinkList -Owner $Owner -Repo $Repo -Context $Context + process { + try { + switch ($PSCmdlet.ParameterSetName) { + 'ById' { + Get-GitHubRepositoryAutolinkById -Owner $Owner -Repo $Repo -ID $AutolinkId -Context $Context + } + default { + Get-GitHubRepositoryAutolinkList -Owner $Owner -Repo $Repo -Context $Context + } + } + } catch { + throw $_ } } + + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/public/Repositories/Autolinks/New-GitHubRepositoryAutolink.ps1 b/src/functions/public/Repositories/Autolinks/New-GitHubRepositoryAutolink.ps1 index a51ca8c8..2f4a6ed6 100644 --- a/src/functions/public/Repositories/Autolinks/New-GitHubRepositoryAutolink.ps1 +++ b/src/functions/public/Repositories/Autolinks/New-GitHubRepositoryAutolink.ps1 @@ -49,46 +49,49 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner - } - Write-Debug "Owner : [$($Context.Owner)]" + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo - } - Write-Debug "Repo : [$($Context.Repo)]" - - $PSCmdlet.MyInvocation.MyCommand.Parameters.GetEnumerator() | ForEach-Object { - $paramName = $_.Key - $paramDefaultValue = Get-Variable -Name $paramName -ValueOnly -ErrorAction SilentlyContinue - $providedValue = $PSBoundParameters[$paramName] - Write-Verbose "[$paramName]" - Write-Verbose " - Default: [$paramDefaultValue]" - Write-Verbose " - Provided: [$providedValue]" - if (-not $PSBoundParameters.ContainsKey($paramName) -and ($null -ne $paramDefaultValue)) { - Write-Verbose ' - Using default value' - $PSBoundParameters[$paramName] = $paramDefaultValue - } else { - Write-Verbose ' - Using provided value' + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo } + Write-Debug "Repo : [$($Context.Repo)]" } - $body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case - Remove-HashtableEntry -Hashtable $body -RemoveNames 'Owner', 'Repo' -RemoveTypes 'SwitchParameter' - - $inputObject = @{ - Context = $Context - APIEndpoint = "/repos/$Owner/$Repo/autolinks" - Method = 'POST' - Body = $body + process { + try { + $body = @{ + key_prefix = $KeyPrefix + url_template = $UrlTemplate + is_alphanumeric = $IsAlphanumeric + } + + $inputObject = @{ + Context = $Context + APIEndpoint = "/repos/$Owner/$Repo/autolinks" + Method = 'POST' + Body = $body + } + + if ($PSCmdlet.ShouldProcess("Autolink for repository [$Owner/$Repo]", 'Create')) { + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } + } catch { + throw $_ + } } - if ($PSCmdlet.ShouldProcess("Autolink for repository [$Owner/$Repo]", 'Create')) { - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response - } + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Repositories/Autolinks/Remove-GitHubRepositoryAutolink.ps1 b/src/functions/public/Repositories/Autolinks/Remove-GitHubRepositoryAutolink.ps1 index 7a0f2029..b86a5434 100644 --- a/src/functions/public/Repositories/Autolinks/Remove-GitHubRepositoryAutolink.ps1 +++ b/src/functions/public/Repositories/Autolinks/Remove-GitHubRepositoryAutolink.ps1 @@ -40,28 +40,43 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner - } - Write-Debug "Owner : [$($Context.Owner)]" + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo + } + Write-Debug "Repo : [$($Context.Repo)]" } - Write-Debug "Repo : [$($Context.Repo)]" - $inputObject = @{ - Context = $Context - APIEndpoint = "/repos/$Owner/$Repo/autolinks/$AutolinkId" - Method = 'DELETE' - Body = $body - } + process { + try { + $inputObject = @{ + Context = $Context + APIEndpoint = "/repos/$Owner/$Repo/autolinks/$AutolinkId" + Method = 'DELETE' + Body = $body + } - if ($PSCmdlet.ShouldProcess("Autolink with ID [$AutolinkId] for repository [$Owner/$Repo]", 'Delete')) { - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + if ($PSCmdlet.ShouldProcess("Autolink with ID [$AutolinkId] for repository [$Owner/$Repo]", 'Delete')) { + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } + } catch { + throw $_ } } + + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/public/Repositories/CustomProperties/Get-GitHubRepositoryCustomProperty.ps1 b/src/functions/public/Repositories/CustomProperties/Get-GitHubRepositoryCustomProperty.ps1 index cc78d297..0c9099de 100644 --- a/src/functions/public/Repositories/CustomProperties/Get-GitHubRepositoryCustomProperty.ps1 +++ b/src/functions/public/Repositories/CustomProperties/Get-GitHubRepositoryCustomProperty.ps1 @@ -36,25 +36,40 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner - } - Write-Debug "Owner : [$($Context.Owner)]" + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo + } + Write-Debug "Repo : [$($Context.Repo)]" } - Write-Debug "Repo : [$($Context.Repo)]" - $inputObject = @{ - Context = $Context - APIEndpoint = "/repos/$Owner/$Repo/properties/values" - Method = 'GET' + process { + try { + $inputObject = @{ + Context = $Context + APIEndpoint = "/repos/$Owner/$Repo/properties/values" + Method = 'GET' + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Repositories/Repositories/Disable-GitHubRepositoryPrivateVulnerabilityReporting.ps1 b/src/functions/public/Repositories/Repositories/Disable-GitHubRepositoryPrivateVulnerabilityReporting.ps1 index 91656093..62555e53 100644 --- a/src/functions/public/Repositories/Repositories/Disable-GitHubRepositoryPrivateVulnerabilityReporting.ps1 +++ b/src/functions/public/Repositories/Repositories/Disable-GitHubRepositoryPrivateVulnerabilityReporting.ps1 @@ -35,27 +35,42 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner - } - Write-Debug "Owner : [$($Context.Owner)]" + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo + } + Write-Debug "Repo : [$($Context.Repo)]" } - Write-Debug "Repo : [$($Context.Repo)]" - $inputObject = @{ - Context = $Context - APIEndpoint = "/repos/$Owner/$Repo/private-vulnerability-reporting" - Method = 'DELETE' - } + process { + try { + $inputObject = @{ + Context = $Context + APIEndpoint = "/repos/$Owner/$Repo/private-vulnerability-reporting" + Method = 'DELETE' + } - if ($PSCmdlet.ShouldProcess("Private Vulnerability Reporting for [$Owner/$Repo]", 'Disable')) { - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + if ($PSCmdlet.ShouldProcess("Private Vulnerability Reporting for [$Owner/$Repo]", 'Disable')) { + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } + } catch { + throw $_ } } + + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/public/Repositories/Repositories/Disable-GitHubRepositorySecurityFix.ps1 b/src/functions/public/Repositories/Repositories/Disable-GitHubRepositorySecurityFix.ps1 index 2453db36..344ded1a 100644 --- a/src/functions/public/Repositories/Repositories/Disable-GitHubRepositorySecurityFix.ps1 +++ b/src/functions/public/Repositories/Repositories/Disable-GitHubRepositorySecurityFix.ps1 @@ -35,27 +35,42 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner - } - Write-Debug "Owner : [$($Context.Owner)]" + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo + } + Write-Debug "Repo : [$($Context.Repo)]" } - Write-Debug "Repo : [$($Context.Repo)]" - $inputObject = @{ - Context = $Context - APIEndpoint = "/repos/$Owner/$Repo/automated-security-fixes" - Method = 'DELETE' - } + process { + try { + $inputObject = @{ + Context = $Context + APIEndpoint = "/repos/$Owner/$Repo/automated-security-fixes" + Method = 'DELETE' + } - if ($PSCmdlet.ShouldProcess("Security Fixes for [$Owner/$Repo]", 'Disable')) { - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + if ($PSCmdlet.ShouldProcess("Security Fixes for [$Owner/$Repo]", 'Disable')) { + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } + } catch { + throw $_ } } + + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/public/Repositories/Repositories/Disable-GitHubRepositoryVulnerabilityAlert.ps1 b/src/functions/public/Repositories/Repositories/Disable-GitHubRepositoryVulnerabilityAlert.ps1 index 1210e40b..f99a5d7c 100644 --- a/src/functions/public/Repositories/Repositories/Disable-GitHubRepositoryVulnerabilityAlert.ps1 +++ b/src/functions/public/Repositories/Repositories/Disable-GitHubRepositoryVulnerabilityAlert.ps1 @@ -34,27 +34,42 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner - } - Write-Debug "Owner : [$($Context.Owner)]" + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo + } + Write-Debug "Repo : [$($Context.Repo)]" } - Write-Debug "Repo : [$($Context.Repo)]" - $inputObject = @{ - Context = $Context - APIEndpoint = "/repos/$Owner/$Repo/vulnerability-alerts" - Method = 'DELETE' - } + process { + try { + $inputObject = @{ + Context = $Context + APIEndpoint = "/repos/$Owner/$Repo/vulnerability-alerts" + Method = 'DELETE' + } - if ($PSCmdlet.ShouldProcess("Vulnerability Alerts for [$Owner/$Repo]", 'Disable')) { - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + if ($PSCmdlet.ShouldProcess("Vulnerability Alerts for [$Owner/$Repo]", 'Disable')) { + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } + } catch { + throw $_ } } + + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/public/Repositories/Repositories/Enable-GitHubRepositoryPrivateVulnerabilityReporting.ps1 b/src/functions/public/Repositories/Repositories/Enable-GitHubRepositoryPrivateVulnerabilityReporting.ps1 index bf8642b3..ebaf8cb9 100644 --- a/src/functions/public/Repositories/Repositories/Enable-GitHubRepositoryPrivateVulnerabilityReporting.ps1 +++ b/src/functions/public/Repositories/Repositories/Enable-GitHubRepositoryPrivateVulnerabilityReporting.ps1 @@ -35,27 +35,42 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner - } - Write-Debug "Owner : [$($Context.Owner)]" + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo + } + Write-Debug "Repo : [$($Context.Repo)]" } - Write-Debug "Repo : [$($Context.Repo)]" - $inputObject = @{ - Context = $Context - APIEndpoint = "/repos/$Owner/$Repo/private-vulnerability-reporting" - Method = 'PUT' - } + process { + try { + $inputObject = @{ + Context = $Context + APIEndpoint = "/repos/$Owner/$Repo/private-vulnerability-reporting" + Method = 'PUT' + } - if ($PSCmdlet.ShouldProcess("Private Vulnerability Reporting for [$Owner/$Repo]", 'Enable')) { - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + if ($PSCmdlet.ShouldProcess("Private Vulnerability Reporting for [$Owner/$Repo]", 'Enable')) { + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } + } catch { + throw $_ } } + + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/public/Repositories/Repositories/Enable-GitHubRepositorySecurityFix.ps1 b/src/functions/public/Repositories/Repositories/Enable-GitHubRepositorySecurityFix.ps1 index 1c4a730b..9d9b1154 100644 --- a/src/functions/public/Repositories/Repositories/Enable-GitHubRepositorySecurityFix.ps1 +++ b/src/functions/public/Repositories/Repositories/Enable-GitHubRepositorySecurityFix.ps1 @@ -35,27 +35,42 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner - } - Write-Debug "Owner : [$($Context.Owner)]" + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo + } + Write-Debug "Repo : [$($Context.Repo)]" } - Write-Debug "Repo : [$($Context.Repo)]" - $inputObject = @{ - Context = $Context - APIEndpoint = "/repos/$Owner/$Repo/automated-security-fixes" - Method = 'PUT' - } + process { + try { + $inputObject = @{ + Context = $Context + APIEndpoint = "/repos/$Owner/$Repo/automated-security-fixes" + Method = 'PUT' + } - if ($PSCmdlet.ShouldProcess("Security Fixes for [$Owner/$Repo]", 'Enable')) { - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + if ($PSCmdlet.ShouldProcess("Security Fixes for [$Owner/$Repo]", 'Enable')) { + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } + } catch { + throw $_ } } + + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/public/Repositories/Repositories/Enable-GitHubRepositoryVulnerabilityAlert.ps1 b/src/functions/public/Repositories/Repositories/Enable-GitHubRepositoryVulnerabilityAlert.ps1 index df3e409f..95324abf 100644 --- a/src/functions/public/Repositories/Repositories/Enable-GitHubRepositoryVulnerabilityAlert.ps1 +++ b/src/functions/public/Repositories/Repositories/Enable-GitHubRepositoryVulnerabilityAlert.ps1 @@ -35,27 +35,42 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner - } - Write-Debug "Owner : [$($Context.Owner)]" + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo + } + Write-Debug "Repo : [$($Context.Repo)]" } - Write-Debug "Repo : [$($Context.Repo)]" - $inputObject = @{ - Context = $Context - APIEndpoint = "/repos/$Owner/$Repo/vulnerability-alerts" - Method = 'PUT' - } + process { + try { + $inputObject = @{ + Context = $Context + APIEndpoint = "/repos/$Owner/$Repo/vulnerability-alerts" + Method = 'PUT' + } - if ($PSCmdlet.ShouldProcess("Vulnerability Alerts for [$Owner/$Repo]", 'Enable')) { - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + if ($PSCmdlet.ShouldProcess("Vulnerability Alerts for [$Owner/$Repo]", 'Enable')) { + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } + } catch { + throw $_ } } + + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/public/Repositories/Repositories/Get-GitHubRepository.ps1 b/src/functions/public/Repositories/Repositories/Get-GitHubRepository.ps1 index 3db6282b..a7cb7c8e 100644 --- a/src/functions/public/Repositories/Repositories/Get-GitHubRepository.ps1 +++ b/src/functions/public/Repositories/Repositories/Get-GitHubRepository.ps1 @@ -162,8 +162,10 @@ filter Get-GitHubRepository { } begin { - $Type = $PSBoundParameters['Type'] + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner @@ -177,72 +179,80 @@ filter Get-GitHubRepository { } process { - $params = @{ - Context = $Context - } - switch ($PSCmdlet.ParameterSetName) { - 'MyRepos_Type' { - $params += @{ - Type = $Type - Sort = $Sort - Direction = $Direction - PerPage = $PerPage - Since = $Since - Before = $Before - } - Remove-HashtableEntry -Hashtable $params -NullOrEmptyValues - Get-GitHubMyRepositories @params + try { + $params = @{ + Context = $Context } - 'MyRepos_Aff-Vis' { - $params += @{ - Visibility = $Visibility - Affiliation = $Affiliation - Sort = $Sort - Direction = $Direction - PerPage = $PerPage - Since = $Since - Before = $Before + switch ($PSCmdlet.ParameterSetName) { + 'MyRepos_Type' { + $params += @{ + Type = $Type + Sort = $Sort + Direction = $Direction + PerPage = $PerPage + Since = $Since + Before = $Before + } + Remove-HashtableEntry -Hashtable $params -NullOrEmptyValues + Get-GitHubMyRepositories @params } - Remove-HashtableEntry -Hashtable $params -NullOrEmptyValues - Get-GitHubMyRepositories @params - } - 'ByName' { - $params += @{ - Owner = $Owner - Repo = $Repo + 'MyRepos_Aff-Vis' { + $params += @{ + Visibility = $Visibility + Affiliation = $Affiliation + Sort = $Sort + Direction = $Direction + PerPage = $PerPage + Since = $Since + Before = $Before + } + Remove-HashtableEntry -Hashtable $params -NullOrEmptyValues + Get-GitHubMyRepositories @params } - Remove-HashtableEntry -Hashtable $params -NullOrEmptyValues - Get-GitHubRepositoryByName @params - } - 'ListByID' { - $params += @{ - Since = $SinceID + 'ByName' { + $params += @{ + Owner = $Owner + Repo = $Repo + } + Remove-HashtableEntry -Hashtable $params -NullOrEmptyValues + Get-GitHubRepositoryByName @params } - Remove-HashtableEntry -Hashtable $params -NullOrEmptyValues - Get-GitHubRepositoryListByID @params - } - 'ListByOrg' { - $params += @{ - Owner = $Owner - Type = $Type - Sort = $Sort - Direction = $Direction - PerPage = $PerPage + 'ListByID' { + $params += @{ + Since = $SinceID + } + Remove-HashtableEntry -Hashtable $params -NullOrEmptyValues + Get-GitHubRepositoryListByID @params } - Remove-HashtableEntry -Hashtable $params -NullOrEmptyValues - Get-GitHubRepositoryListByOrg @params - } - 'ListByUser' { - $params += @{ - Username = $Username - Type = $Type - Sort = $Sort - Direction = $Direction - PerPage = $PerPage + 'ListByOrg' { + $params += @{ + Owner = $Owner + Type = $Type + Sort = $Sort + Direction = $Direction + PerPage = $PerPage + } + Remove-HashtableEntry -Hashtable $params -NullOrEmptyValues + Get-GitHubRepositoryListByOrg @params + } + 'ListByUser' { + $params += @{ + Username = $Username + Type = $Type + Sort = $Sort + Direction = $Direction + PerPage = $PerPage + } + Remove-HashtableEntry -Hashtable $params -NullOrEmptyValues + Get-GitHubRepositoryListByUser @params } - Remove-HashtableEntry -Hashtable $params -NullOrEmptyValues - Get-GitHubRepositoryListByUser @params } + } catch { + throw $_ } } + + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryActivity.ps1 b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryActivity.ps1 index 5acc9b83..7efe90f7 100644 --- a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryActivity.ps1 +++ b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryActivity.ps1 @@ -109,44 +109,52 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner - } - Write-Debug "Owner : [$($Context.Owner)]" + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo - } - Write-Debug "Repo : [$($Context.Repo)]" - - $PSCmdlet.MyInvocation.MyCommand.Parameters.GetEnumerator() | ForEach-Object { - $paramName = $_.Key - $paramDefaultValue = Get-Variable -Name $paramName -ValueOnly -ErrorAction SilentlyContinue - $providedValue = $PSBoundParameters[$paramName] - Write-Verbose "[$paramName]" - Write-Verbose " - Default: [$paramDefaultValue]" - Write-Verbose " - Provided: [$providedValue]" - if (-not $PSBoundParameters.ContainsKey($paramName) -and ($null -ne $paramDefaultValue)) { - Write-Verbose ' - Using default value' - $PSBoundParameters[$paramName] = $paramDefaultValue - } else { - Write-Verbose ' - Using provided value' + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo } + Write-Debug "Repo : [$($Context.Repo)]" } - $body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case - Remove-HashtableEntry -Hashtable $body -RemoveNames 'Owner', 'Repo' -RemoveTypes 'SwitchParameter' - - $inputObject = @{ - Context = $Context - APIEndpoint = "/repos/$Owner/$Repo/activity" - Method = 'GET' - Body = $body + process { + try { + $body = @{ + direction = $Direction + per_page = $PerPage + before = $Before + after = $After + ref = $Ref + actor = $Actor + time_period = $TimePeriod + activity_type = $ActivityType + } | Remove-HashtableEntry -NullOrEmptyValues + + $inputObject = @{ + Context = $Context + APIEndpoint = "/repos/$Owner/$Repo/activity" + Method = 'GET' + Body = $body + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryCodeownersError.ps1 b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryCodeownersError.ps1 index f045a2dd..d0cde188 100644 --- a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryCodeownersError.ps1 +++ b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryCodeownersError.ps1 @@ -41,44 +41,45 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner - } - Write-Debug "Owner : [$($Context.Owner)]" + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo - } - Write-Debug "Repo : [$($Context.Repo)]" - - $PSCmdlet.MyInvocation.MyCommand.Parameters.GetEnumerator() | ForEach-Object { - $paramName = $_.Key - $paramDefaultValue = Get-Variable -Name $paramName -ValueOnly -ErrorAction SilentlyContinue - $providedValue = $PSBoundParameters[$paramName] - Write-Verbose "[$paramName]" - Write-Verbose " - Default: [$paramDefaultValue]" - Write-Verbose " - Provided: [$providedValue]" - if (-not $PSBoundParameters.ContainsKey($paramName) -and ($null -ne $paramDefaultValue)) { - Write-Verbose ' - Using default value' - $PSBoundParameters[$paramName] = $paramDefaultValue - } else { - Write-Verbose ' - Using provided value' + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo } + Write-Debug "Repo : [$($Context.Repo)]" } - $body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case - Remove-HashtableEntry -Hashtable $body -RemoveNames 'Owner', 'Repo' -RemoveTypes 'SwitchParameter' - - $inputObject = @{ - Context = $Context - APIEndpoint = "/repos/$Owner/$Repo/codeowners/errors" - Method = 'GET' - Body = $body + process { + try { + $body = @{ + ref = $Ref + } | Remove-HashtableEntry -NullOrEmptyValues + + $inputObject = @{ + Context = $Context + APIEndpoint = "/repos/$Owner/$Repo/codeowners/errors" + Method = 'GET' + Body = $body + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryContributor.ps1 b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryContributor.ps1 index add2f3ad..8d7ccf9c 100644 --- a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryContributor.ps1 +++ b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryContributor.ps1 @@ -46,29 +46,46 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner - } - Write-Debug "Owner : [$($Context.Owner)]" - - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" + + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo + } + Write-Debug "Repo : [$($Context.Repo)]" } - Write-Debug "Repo : [$($Context.Repo)]" - - $body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case - Remove-HashtableEntry -Hashtable $body -RemoveNames 'Owner', 'Repo' -RemoveTypes 'SwitchParameter' - $inputObject = @{ - Context = $Context - APIEndpoint = "/repos/$Owner/$Repo/contributors" - Method = 'GET' - Body = $body + process { + try { + $body = @{ + anon = $Anon + per_page = $PerPage + } | Remove-HashtableEntry -NullOrEmptyValues + + $inputObject = @{ + Context = $Context + APIEndpoint = "/repos/$Owner/$Repo/contributors" + Method = 'GET' + Body = $body + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryFork.ps1 b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryFork.ps1 index 10d39aea..c2ec5efc 100644 --- a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryFork.ps1 +++ b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryFork.ps1 @@ -42,44 +42,46 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner - } - Write-Debug "Owner : [$($Context.Owner)]" + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo - } - Write-Debug "Repo : [$($Context.Repo)]" - - $PSCmdlet.MyInvocation.MyCommand.Parameters.GetEnumerator() | ForEach-Object { - $paramName = $_.Key - $paramDefaultValue = Get-Variable -Name $paramName -ValueOnly -ErrorAction SilentlyContinue - $providedValue = $PSBoundParameters[$paramName] - Write-Verbose "[$paramName]" - Write-Verbose " - Default: [$paramDefaultValue]" - Write-Verbose " - Provided: [$providedValue]" - if (-not $PSBoundParameters.ContainsKey($paramName) -and ($null -ne $paramDefaultValue)) { - Write-Verbose ' - Using default value' - $PSBoundParameters[$paramName] = $paramDefaultValue - } else { - Write-Verbose ' - Using provided value' + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo } + Write-Debug "Repo : [$($Context.Repo)]" } - $body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case - Remove-HashtableEntry -Hashtable $body -RemoveNames 'Owner', 'Repo' -RemoveTypes 'SwitchParameter' - - $inputObject = @{ - Context = $Context - APIEndpoint = "/repos/$Owner/$Repo/forks" - Method = 'GET' - Body = $body + process { + try { + $body = @{ + sort = $Sort + per_page = $PerPage + } | Remove-HashtableEntry -NullOrEmptyValues + + $inputObject = @{ + Context = $Context + APIEndpoint = "/repos/$Owner/$Repo/forks" + Method = 'GET' + Body = $body + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryLanguage.ps1 b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryLanguage.ps1 index 7acd6c3b..01a41ef1 100644 --- a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryLanguage.ps1 +++ b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryLanguage.ps1 @@ -34,25 +34,40 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner - } - Write-Debug "Owner : [$($Context.Owner)]" + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo + } + Write-Debug "Repo : [$($Context.Repo)]" } - Write-Debug "Repo : [$($Context.Repo)]" - $inputObject = @{ - Context = $Context - APIEndpoint = "/repos/$Owner/$Repo/languages" - Method = 'GET' + process { + try { + $inputObject = @{ + Context = $Context + APIEndpoint = "/repos/$Owner/$Repo/languages" + Method = 'GET' + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Repositories/Repositories/Get-GitHubRepositorySecurityFix.ps1 b/src/functions/public/Repositories/Repositories/Get-GitHubRepositorySecurityFix.ps1 index f8b09697..4f8fb7e8 100644 --- a/src/functions/public/Repositories/Repositories/Get-GitHubRepositorySecurityFix.ps1 +++ b/src/functions/public/Repositories/Repositories/Get-GitHubRepositorySecurityFix.ps1 @@ -36,25 +36,40 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner - } - Write-Debug "Owner : [$($Context.Owner)]" + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo + } + Write-Debug "Repo : [$($Context.Repo)]" } - Write-Debug "Repo : [$($Context.Repo)]" - $inputObject = @{ - Context = $Context - APIEndpoint = "/repos/$Owner/$Repo/automated-security-fixes" - Method = 'GET' + process { + try { + $inputObject = @{ + Context = $Context + APIEndpoint = "/repos/$Owner/$Repo/automated-security-fixes" + Method = 'GET' + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryTag.ps1 b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryTag.ps1 index b8a08263..44c10791 100644 --- a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryTag.ps1 +++ b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryTag.ps1 @@ -38,30 +38,45 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner - } - Write-Debug "Owner : [$($Context.Owner)]" + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo + } + Write-Debug "Repo : [$($Context.Repo)]" } - Write-Debug "Repo : [$($Context.Repo)]" - $body = @{ - per_page = $PerPage - } + process { + try { + $body = @{ + per_page = $PerPage + } + + $inputObject = @{ + Context = $Context + APIEndpoint = "/repos/$Owner/$Repo/tags" + Method = 'GET' + Body = $body + } - $inputObject = @{ - Context = $Context - APIEndpoint = "/repos/$Owner/$Repo/tags" - Method = 'GET' - Body = $body + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryTeam.ps1 b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryTeam.ps1 index 0f8a9083..6984d444 100644 --- a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryTeam.ps1 +++ b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryTeam.ps1 @@ -46,30 +46,45 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner - } - Write-Debug "Owner : [$($Context.Owner)]" - - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo - } - Write-Debug "Repo : [$($Context.Repo)]" - - $body = @{ - per_page = $PerPage + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" + + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo + } + Write-Debug "Repo : [$($Context.Repo)]" } - $inputObject = @{ - Context = $Context - APIEndpoint = "/repos/$Owner/$Repo/teams" - Method = 'GET' - Body = $body + process { + try { + $body = @{ + per_page = $PerPage + } + + $inputObject = @{ + Context = $Context + APIEndpoint = "/repos/$Owner/$Repo/teams" + Method = 'GET' + Body = $body + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryTopic.ps1 b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryTopic.ps1 index 81caa1d5..ec156fe3 100644 --- a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryTopic.ps1 +++ b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryTopic.ps1 @@ -34,30 +34,45 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner - } - Write-Debug "Owner : [$($Context.Owner)]" + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo + } + Write-Debug "Repo : [$($Context.Repo)]" } - Write-Debug "Repo : [$($Context.Repo)]" - $body = @{ - per_page = $PerPage - } + process { + try { + $body = @{ + per_page = $PerPage + } + + $inputObject = @{ + Context = $Context + APIEndpoint = "/repos/$Owner/$Repo/topics" + Method = 'GET' + Body = $body + } - $inputObject = @{ - Context = $Context - APIEndpoint = "/repos/$Owner/$Repo/topics" - Method = 'GET' - Body = $body + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response.names + } + } catch { + throw $_ + } } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response.names + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Repositories/Repositories/Move-GitHubRepository.ps1 b/src/functions/public/Repositories/Repositories/Move-GitHubRepository.ps1 index dd97b240..d50c6745 100644 --- a/src/functions/public/Repositories/Repositories/Move-GitHubRepository.ps1 +++ b/src/functions/public/Repositories/Repositories/Move-GitHubRepository.ps1 @@ -52,44 +52,47 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner - } - Write-Debug "Owner : [$($Context.Owner)]" + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo - } - Write-Debug "Repo : [$($Context.Repo)]" - - $PSCmdlet.MyInvocation.MyCommand.Parameters.GetEnumerator() | ForEach-Object { - $paramName = $_.Key - $paramDefaultValue = Get-Variable -Name $paramName -ValueOnly -ErrorAction SilentlyContinue - $providedValue = $PSBoundParameters[$paramName] - Write-Verbose "[$paramName]" - Write-Verbose " - Default: [$paramDefaultValue]" - Write-Verbose " - Provided: [$providedValue]" - if (-not $PSBoundParameters.ContainsKey($paramName) -and ($null -ne $paramDefaultValue)) { - Write-Verbose ' - Using default value' - $PSBoundParameters[$paramName] = $paramDefaultValue - } else { - Write-Verbose ' - Using provided value' + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo } + Write-Debug "Repo : [$($Context.Repo)]" } - $body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case - Remove-HashtableEntry -Hashtable $body -RemoveNames 'Owner', 'Repo' -RemoveTypes 'SwitchParameter' - - $inputObject = @{ - Context = $Context - APIEndpoint = "/repos/$Owner/$Repo/transfer" - Method = 'POST' - Body = $body + process { + try { + $body = @{ + new_owner = $NewOwner + new_name = $NewName + team_ids = $TeamIds + } | Remove-HashtableEntry -NullOrEmptyValues + + $inputObject = @{ + Context = $Context + APIEndpoint = "/repos/$Owner/$Repo/transfer" + Method = 'POST' + Body = $body + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Repositories/Repositories/New-GitHubRepository.ps1 b/src/functions/public/Repositories/Repositories/New-GitHubRepository.ps1 index 24f3f456..4d23fc04 100644 --- a/src/functions/public/Repositories/Repositories/New-GitHubRepository.ps1 +++ b/src/functions/public/Repositories/Repositories/New-GitHubRepository.ps1 @@ -328,93 +328,103 @@ filter New-GitHubRepository { } begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } Write-Debug "Owner : [$($Context.Owner)]" - - $GitignoreTemplate = $PSBoundParameters['GitignoreTemplate'] - $LicenseTemplate = $PSBoundParameters['LicenseTemplate'] } process { - if ($PSCmdlet.ParameterSetName -in 'user', 'org') { - $params = @{ - Context = $Context - Owner = $Owner - Name = $Name - Description = $Description - Homepage = $Homepage - Visibility = $Visibility - HasIssues = $HasIssues - HasProjects = $HasProjects - HasWiki = $HasWiki - HasDiscussions = $HasDiscussions - HasDownloads = $HasDownloads - IsTemplate = $IsTemplate - TeamId = $TeamId - AutoInit = $AutoInit - AllowSquashMerge = $AllowSquashMerge - AllowMergeCommit = $AllowMergeCommit - AllowRebaseMerge = $AllowRebaseMerge - AllowAutoMerge = $AllowAutoMerge - DeleteBranchOnMerge = $DeleteBranchOnMerge - SquashMergeCommitTitle = $SquashMergeCommitTitle - SquashMergeCommitMessage = $SquashMergeCommitMessage - MergeCommitTitle = $MergeCommitTitle - MergeCommitMessage = $MergeCommitMessage - GitignoreTemplate = $GitignoreTemplate - LicenseTemplate = $LicenseTemplate - } - Remove-HashtableEntry -Hashtable $params -NullOrEmptyValues - } - - switch ($PSCmdlet.ParameterSetName) { - 'user' { - if ($PSCmdlet.ShouldProcess("repository for user [$Name]", 'Create')) { - New-GitHubRepositoryUser @params + try { + $GitignoreTemplate = $PSBoundParameters['GitignoreTemplate'] + $LicenseTemplate = $PSBoundParameters['LicenseTemplate'] + if ($PSCmdlet.ParameterSetName -in 'user', 'org') { + $params = @{ + Context = $Context + Owner = $Owner + Name = $Name + Description = $Description + Homepage = $Homepage + Visibility = $Visibility + HasIssues = $HasIssues + HasProjects = $HasProjects + HasWiki = $HasWiki + HasDiscussions = $HasDiscussions + HasDownloads = $HasDownloads + IsTemplate = $IsTemplate + TeamId = $TeamId + AutoInit = $AutoInit + AllowSquashMerge = $AllowSquashMerge + AllowMergeCommit = $AllowMergeCommit + AllowRebaseMerge = $AllowRebaseMerge + AllowAutoMerge = $AllowAutoMerge + DeleteBranchOnMerge = $DeleteBranchOnMerge + SquashMergeCommitTitle = $SquashMergeCommitTitle + SquashMergeCommitMessage = $SquashMergeCommitMessage + MergeCommitTitle = $MergeCommitTitle + MergeCommitMessage = $MergeCommitMessage + GitignoreTemplate = $GitignoreTemplate + LicenseTemplate = $LicenseTemplate } + Remove-HashtableEntry -Hashtable $params -NullOrEmptyValues } - 'org' { - if ($PSCmdlet.ShouldProcess("repository for organization [$Owner/$Name]", 'Create')) { - New-GitHubRepositoryOrg @params + + switch ($PSCmdlet.ParameterSetName) { + 'user' { + if ($PSCmdlet.ShouldProcess("repository for user [$Name]", 'Create')) { + New-GitHubRepositoryUser @params + } } - } - 'template' { - if ($PSCmdlet.ShouldProcess("repository [$Owner/$Name] from template [$TemplateOwner/$TemplateRepo]", 'Create')) { - $params = @{ - Context = $Context - TemplateOwner = $TemplateOwner - TemplateRepo = $TemplateRepo - Owner = $Owner - Name = $Name - IncludeAllBranches = $IncludeAllBranches - Description = $Description - Private = $Visibility -eq 'private' + 'org' { + if ($PSCmdlet.ShouldProcess("repository for organization [$Owner/$Name]", 'Create')) { + New-GitHubRepositoryOrg @params } - Remove-HashtableEntry -Hashtable $params -NullOrEmptyValues - New-GitHubRepositoryFromTemplate @params } - } - 'fork' { - if ([string]::IsNullorEmpty($Name)) { - $Name = $ForkRepo + 'template' { + if ($PSCmdlet.ShouldProcess("repository [$Owner/$Name] from template [$TemplateOwner/$TemplateRepo]", 'Create')) { + $params = @{ + Context = $Context + TemplateOwner = $TemplateOwner + TemplateRepo = $TemplateRepo + Owner = $Owner + Name = $Name + IncludeAllBranches = $IncludeAllBranches + Description = $Description + Private = $Visibility -eq 'private' + } + Remove-HashtableEntry -Hashtable $params -NullOrEmptyValues + New-GitHubRepositoryFromTemplate @params + } } - if ($PSCmdlet.ShouldProcess("repository [$Owner/$Name] as fork from [$ForkOwner/$ForkRepo]", 'Create')) { - $params = @{ - Context = $Context - Owner = $ForkOwner - Repo = $ForkRepo - Organization = $Owner - Name = $Name - DefaultBranchOnly = $DefaultBranchOnly + 'fork' { + if ([string]::IsNullorEmpty($Name)) { + $Name = $ForkRepo + } + if ($PSCmdlet.ShouldProcess("repository [$Owner/$Name] as fork from [$ForkOwner/$ForkRepo]", 'Create')) { + $params = @{ + Context = $Context + Owner = $ForkOwner + Repo = $ForkRepo + Organization = $Owner + Name = $Name + DefaultBranchOnly = $DefaultBranchOnly + } + Remove-HashtableEntry -Hashtable $params -NullOrEmptyValues + New-GitHubRepositoryAsFork @params } - Remove-HashtableEntry -Hashtable $params -NullOrEmptyValues - New-GitHubRepositoryAsFork @params } } + } catch { + throw $_ } } + + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/public/Repositories/Repositories/Remove-GitHubRepository.ps1 b/src/functions/public/Repositories/Repositories/Remove-GitHubRepository.ps1 index 1ebe1907..8f673db6 100644 --- a/src/functions/public/Repositories/Repositories/Remove-GitHubRepository.ps1 +++ b/src/functions/public/Repositories/Repositories/Remove-GitHubRepository.ps1 @@ -36,27 +36,42 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner - } - Write-Debug "Owner : [$($Context.Owner)]" + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo + } + Write-Debug "Repo : [$($Context.Repo)]" } - Write-Debug "Repo : [$($Context.Repo)]" - $inputObject = @{ - Context = $Context - APIEndpoint = "/repos/$Owner/$Repo" - Method = 'DELETE' - } + process { + try { + $inputObject = @{ + Context = $Context + APIEndpoint = "/repos/$Owner/$Repo" + Method = 'DELETE' + } - if ($PSCmdlet.ShouldProcess("repo [$Owner/$Repo]", 'Delete')) { - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + if ($PSCmdlet.ShouldProcess("repo [$Owner/$Repo]", 'Delete')) { + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } + } catch { + throw $_ } } + + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/public/Repositories/Repositories/Set-GitHubRepositoryTopic.ps1 b/src/functions/public/Repositories/Repositories/Set-GitHubRepositoryTopic.ps1 index 5142ee5a..cb15c9b4 100644 --- a/src/functions/public/Repositories/Repositories/Set-GitHubRepositoryTopic.ps1 +++ b/src/functions/public/Repositories/Repositories/Set-GitHubRepositoryTopic.ps1 @@ -36,32 +36,47 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner - } - Write-Debug "Owner : [$($Context.Owner)]" + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo + } + Write-Debug "Repo : [$($Context.Repo)]" } - Write-Debug "Repo : [$($Context.Repo)]" - $body = @{ - names = $Names | ForEach-Object { $_.ToLower() } - } + process { + try { + $body = @{ + names = $Names | ForEach-Object { $_.ToLower() } + } - $inputObject = @{ - Context = $Context - APIEndpoint = "/repos/$Owner/$Repo/topics" - Method = 'PUT' - Body = $body - } + $inputObject = @{ + Context = $Context + APIEndpoint = "/repos/$Owner/$Repo/topics" + Method = 'PUT' + Body = $body + } - if ($PSCmdlet.ShouldProcess("topics for repo [$Owner/$Repo]", 'Set')) { - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response.names + if ($PSCmdlet.ShouldProcess("topics for repo [$Owner/$Repo]", 'Set')) { + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response.names + } + } + } catch { + throw $_ } } + + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/public/Repositories/Repositories/Start-GitHubRepositoryEvent.ps1 b/src/functions/public/Repositories/Repositories/Start-GitHubRepositoryEvent.ps1 index 8775d742..59c6c929 100644 --- a/src/functions/public/Repositories/Repositories/Start-GitHubRepositoryEvent.ps1 +++ b/src/functions/public/Repositories/Repositories/Start-GitHubRepositoryEvent.ps1 @@ -69,44 +69,46 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner - } - Write-Debug "Owner : [$($Context.Owner)]" + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo - } - Write-Debug "Repo : [$($Context.Repo)]" - - $PSCmdlet.MyInvocation.MyCommand.Parameters.GetEnumerator() | ForEach-Object { - $paramName = $_.Key - $paramDefaultValue = Get-Variable -Name $paramName -ValueOnly -ErrorAction SilentlyContinue - $providedValue = $PSBoundParameters[$paramName] - Write-Verbose "[$paramName]" - Write-Verbose " - Default: [$paramDefaultValue]" - Write-Verbose " - Provided: [$providedValue]" - if (-not $PSBoundParameters.ContainsKey($paramName) -and ($null -ne $paramDefaultValue)) { - Write-Verbose ' - Using default value' - $PSBoundParameters[$paramName] = $paramDefaultValue - } else { - Write-Verbose ' - Using provided value' + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo } + Write-Debug "Repo : [$($Context.Repo)]" } - $body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case - Remove-HashtableEntry -Hashtable $body -RemoveNames 'Owner', 'Repo' -RemoveTypes 'SwitchParameter' + process { + try { + $body = @{ + event_type = $EventType + client_payload = $ClientPayload + } | Remove-HashtableEntry -NullOrEmptyValues + + $inputObject = @{ + Context = $Context + APIEndpoint = "/repos/$Owner/$Repo/dispatches" + Method = 'POST' + Body = $body + } - $inputObject = @{ - Context = $Context - APIEndpoint = "/repos/$Owner/$Repo/dispatches" - Method = 'POST' - Body = $body + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Repositories/Repositories/Test-GitHubRepositoryVulnerabilityAlert.ps1 b/src/functions/public/Repositories/Repositories/Test-GitHubRepositoryVulnerabilityAlert.ps1 index f66d8fcf..af470475 100644 --- a/src/functions/public/Repositories/Repositories/Test-GitHubRepositoryVulnerabilityAlert.ps1 +++ b/src/functions/public/Repositories/Repositories/Test-GitHubRepositoryVulnerabilityAlert.ps1 @@ -36,31 +36,42 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner - } - Write-Debug "Owner : [$($Context.Owner)]" + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo + } + Write-Debug "Repo : [$($Context.Repo)]" } - Write-Debug "Repo : [$($Context.Repo)]" - $inputObject = @{ - Context = $Context - APIEndpoint = "/repos/$Owner/$Repo/vulnerability-alerts" - Method = 'GET' - } + process { + $inputObject = @{ + Context = $Context + APIEndpoint = "/repos/$Owner/$Repo/vulnerability-alerts" + Method = 'GET' + } - try { - (Invoke-GitHubAPI @inputObject).StatusCode -eq 204 - } catch { - if ($_.Exception.Response.StatusCode.Value__ -eq 404) { - return $false - } else { - throw $_ + try { + (Invoke-GitHubAPI @inputObject).StatusCode -eq 204 + } catch { + if ($_.Exception.Response.StatusCode.Value__ -eq 404) { + return $false + } else { + throw $_ + } } } + + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/public/Repositories/Repositories/Update-GitHubRepository.ps1 b/src/functions/public/Repositories/Repositories/Update-GitHubRepository.ps1 index 63e47c39..927d64e7 100644 --- a/src/functions/public/Repositories/Repositories/Update-GitHubRepository.ps1 +++ b/src/functions/public/Repositories/Repositories/Update-GitHubRepository.ps1 @@ -177,72 +177,78 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo + } + Write-Debug "Repo : [$($Context.Repo)]" } - Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo - } - Write-Debug "Repo : [$($Context.Repo)]" - - $body = @{ - name = $Name - description = $Description - homepage = $Homepage - visibility = $Visibility - private = $Visibility -eq 'private' - default_branch = $DefaultBranch - squash_merge_commit_title = $SquashMergeCommitTitle - squash_merge_commit_message = $SquashMergeCommitMessage - merge_commit_title = $MergeCommitTitle - merge_commit_message = $MergeCommitMessage - - advanced_security = if ($EnableAdvancedSecurity.IsPresent) { - @{ - status = if ($EnableAdvancedSecurity) { 'enabled' } else { 'disabled' } - } - } else { $null } - secret_scanning = if ($EnableSecretScanning.IsPresent) { - @{ - status = if ($EnableSecretScanning) { 'enabled' } else { 'disabled' } - } - } else { $null } - secret_scanning_push_protection = if ($EnableSecretScanningPushProtection.IsPresent) { - @{ - status = if ($EnableSecretScanningPushProtection) { 'enabled' } else { 'disabled' } + process { + try { + $body = @{ + name = $Name + description = $Description + homepage = $Homepage + visibility = $Visibility + private = $Visibility -eq 'private' + default_branch = $DefaultBranch + squash_merge_commit_title = $SquashMergeCommitTitle + squash_merge_commit_message = $SquashMergeCommitMessage + merge_commit_title = $MergeCommitTitle + merge_commit_message = $MergeCommitMessage + advanced_security = $EnableAdvancedSecurity ? @{ + status = $EnableAdvancedSecurity ? 'enabled' : 'disabled' + } : $null + secret_scanning = $EnableSecretScanning ? @{ + status = $EnableSecretScanning ? 'enabled' : 'disabled' + } : $null + secret_scanning_push_protection = $EnableSecretScanningPushProtection ? @{ + status = $EnableSecretScanningPushProtection ? 'enabled' : 'disabled' + } : $null + has_issues = $HasIssues ? $HasIssues : $null + has_projects = $HasProjects ? $HasProjects : $null + has_wiki = $HasWiki ? $HasWiki : $null + is_template = $IsTemplate ? $IsTemplate : $null + allow_squash_merge = $AllowSquashMerge ? $AllowSquashMerge : $null + allow_merge_commit = $AllowMergeCommit ? $AllowMergeCommit : $null + allow_rebase_merge = $AllowRebaseMerge ? $AllowRebaseMerge : $null + allow_auto_merge = $AllowAutoMerge ? $AllowAutoMerge : $null + allow_update_branch = $AllowUpdateMerge ? $AllowUpdateMerge : $null + delete_branch_on_merge = $DeleteBranchOnMerge ? $DeleteBranchOnMerge : $null + archived = $Archived ? $Archived : $null + allow_forking = $AllowForking ? $AllowForking : $null + web_commit_signoff_required = $WebCommitSignoffRequired ? $WebCommitSignoffRequired : $null + } | Remove-HashtableEntry -NullOrEmptyValues + + $inputObject = @{ + Context = $Context + APIEndpoint = "/repos/$Owner/$Repo" + Method = 'PATCH' + Body = $body } - } else { $null } - has_issues = if ($HasIssues.IsPresent) { $HasIssues } else { $null } - has_projects = if ($HasProjects.IsPresent) { $HasProjects } else { $null } - has_wiki = if ($HasWiki.IsPresent) { $HasWiki } else { $null } - is_template = if ($IsTemplate.IsPresent) { $IsTemplate } else { $null } - allow_squash_merge = if ($AllowSquashMerge.IsPresent) { $AllowSquashMerge } else { $null } - allow_merge_commit = if ($AllowMergeCommit.IsPresent) { $AllowMergeCommit } else { $null } - allow_rebase_merge = if ($AllowRebaseMerge.IsPresent) { $AllowRebaseMerge } else { $null } - allow_auto_merge = if ($AllowAutoMerge.IsPresent) { $AllowAutoMerge } else { $null } - allow_update_branch = if ($AllowUpdateMerge.IsPresent) { $AllowUpdateMerge } else { $null } - delete_branch_on_merge = if ($DeleteBranchOnMerge.IsPresent) { $DeleteBranchOnMerge } else { $null } - archived = if ($Archived.IsPresent) { $Archived } else { $null } - allow_forking = if ($AllowForking.IsPresent) { $AllowForking } else { $null } - web_commit_signoff_required = if ($WebCommitSignoffRequired.IsPresent) { $WebCommitSignoffRequired } else { $null } - } - - Remove-HashtableEntry -Hashtable $body -NullOrEmptyValues - $inputObject = @{ - Context = $Context - APIEndpoint = "/repos/$Owner/$Repo" - Method = 'PATCH' - Body = $body + if ($PSCmdlet.ShouldProcess("Repository [$Owner/$Repo]", 'Update')) { + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } + } catch { + throw $_ + } } - if ($PSCmdlet.ShouldProcess("Repository [$Owner/$Repo]", 'Update')) { - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response - } + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuite.ps1 b/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuite.ps1 index 6222f9ae..5a076609 100644 --- a/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuite.ps1 +++ b/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuite.ps1 @@ -82,40 +82,55 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner - } - Write-Debug "Owner : [$($Context.Owner)]" - - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo - } - Write-Debug "Repo : [$($Context.Repo)]" + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" - $params = @{ - Context = $Context - Owner = $Owner - Repo = $Repo + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo + } + Write-Debug "Repo : [$($Context.Repo)]" } - switch ($PSCmdlet.ParameterSetName) { - 'Default' { - $params += @{ - Ref = $Ref - TimePeriod = $TimePeriod - ActorName = $ActorName - RuleSuiteResult = $RuleSuiteResult - PerPage = $PerPage + process { + try { + $params = @{ + Context = $Context + Owner = $Owner + Repo = $Repo } - Get-GitHubRepositoryRuleSuiteList @params - } - 'ById' { - $params += @{ - RuleSuiteId = $RuleSuiteId + + switch ($PSCmdlet.ParameterSetName) { + 'Default' { + $params += @{ + Ref = $Ref + TimePeriod = $TimePeriod + ActorName = $ActorName + RuleSuiteResult = $RuleSuiteResult + PerPage = $PerPage + } + Get-GitHubRepositoryRuleSuiteList @params + } + 'ById' { + $params += @{ + RuleSuiteId = $RuleSuiteId + } + Get-GitHubRepositoryRuleSuiteById @params + } } - Get-GitHubRepositoryRuleSuiteById @params + } catch { + throw $_ } } + + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuiteById.ps1 b/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuiteById.ps1 index b1a64cca..d0e341fe 100644 --- a/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuiteById.ps1 +++ b/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuiteById.ps1 @@ -38,25 +38,40 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner - } - Write-Debug "Owner : [$($Context.Owner)]" + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo + } + Write-Debug "Repo : [$($Context.Repo)]" } - Write-Debug "Repo : [$($Context.Repo)]" - $inputObject = @{ - Context = $Context - APIEndpoint = "/repos/$Owner/$Repo/rulesets/rule-suites/$RuleSuiteId" - Method = 'GET' + process { + try { + $inputObject = @{ + Context = $Context + APIEndpoint = "/repos/$Owner/$Repo/rulesets/rule-suites/$RuleSuiteId" + Method = 'GET' + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuiteList.ps1 b/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuiteList.ps1 index 70f28673..85ea9e3f 100644 --- a/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuiteList.ps1 +++ b/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuiteList.ps1 @@ -69,44 +69,49 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner - } - Write-Debug "Owner : [$($Context.Owner)]" + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo - } - Write-Debug "Repo : [$($Context.Repo)]" - - $PSCmdlet.MyInvocation.MyCommand.Parameters.GetEnumerator() | ForEach-Object { - $paramName = $_.Key - $paramDefaultValue = Get-Variable -Name $paramName -ValueOnly -ErrorAction SilentlyContinue - $providedValue = $PSBoundParameters[$paramName] - Write-Verbose "[$paramName]" - Write-Verbose " - Default: [$paramDefaultValue]" - Write-Verbose " - Provided: [$providedValue]" - if (-not $PSBoundParameters.ContainsKey($paramName) -and ($null -ne $paramDefaultValue)) { - Write-Verbose ' - Using default value' - $PSBoundParameters[$paramName] = $paramDefaultValue - } else { - Write-Verbose ' - Using provided value' + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo } + Write-Debug "Repo : [$($Context.Repo)]" } - $body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case - Remove-HashtableEntry -Hashtable $body -RemoveNames 'Owner', 'Repo' -RemoveTypes 'SwitchParameter' - - $inputObject = @{ - Context = $Context - APIEndpoint = "/repos/$Owner/$Repo/rulesets/rule-suites" - Method = 'GET' - Body = $body + process { + try { + $body = @{ + ref = $Ref + time_period = $TimePeriod + actor_name = $ActorName + rule_suite_result = $RuleSuiteResult + per_page = $PerPage + } | Remove-HashtableEntry -NullOrEmptyValues + + $inputObject = @{ + Context = $Context + APIEndpoint = "/repos/$Owner/$Repo/rulesets/rule-suites" + Method = 'GET' + Body = $body + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Repositories/Tags/Get-GitHubRepositoryTagProtection.ps1 b/src/functions/public/Repositories/Tags/Get-GitHubRepositoryTagProtection.ps1 index 839820d5..683018d9 100644 --- a/src/functions/public/Repositories/Tags/Get-GitHubRepositoryTagProtection.ps1 +++ b/src/functions/public/Repositories/Tags/Get-GitHubRepositoryTagProtection.ps1 @@ -35,25 +35,40 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner - } - Write-Debug "Owner : [$($Context.Owner)]" + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo + } + Write-Debug "Repo : [$($Context.Repo)]" } - Write-Debug "Repo : [$($Context.Repo)]" - $inputObject = @{ - Context = $Context - APIEndpoint = "/repos/$Owner/$Repo/tags/protection" - Method = 'GET' + process { + try { + $inputObject = @{ + Context = $Context + APIEndpoint = "/repos/$Owner/$Repo/tags/protection" + Method = 'GET' + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Repositories/Tags/New-GitHubRepositoryTagProtection.ps1 b/src/functions/public/Repositories/Tags/New-GitHubRepositoryTagProtection.ps1 index 4428b7ee..c7e69c21 100644 --- a/src/functions/public/Repositories/Tags/New-GitHubRepositoryTagProtection.ps1 +++ b/src/functions/public/Repositories/Tags/New-GitHubRepositoryTagProtection.ps1 @@ -37,32 +37,47 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner - } - Write-Debug "Owner : [$($Context.Owner)]" + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo + } + Write-Debug "Repo : [$($Context.Repo)]" } - Write-Debug "Repo : [$($Context.Repo)]" - $body = @{ - pattern = $Pattern - } + process { + try { + $body = @{ + pattern = $Pattern + } - $inputObject = @{ - Context = $Context - APIEndpoint = "/repos/$Owner/$Repo/tags/protection" - Method = 'POST' - Body = $body - } + $inputObject = @{ + Context = $Context + APIEndpoint = "/repos/$Owner/$Repo/tags/protection" + Method = 'POST' + Body = $body + } - if ($PSCmdlet.ShouldProcess("tag protection state on pattern [$Pattern] for repository [$Owner/$Repo]", 'Create')) { - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + if ($PSCmdlet.ShouldProcess("tag protection state on pattern [$Pattern] for repository [$Owner/$Repo]", 'Create')) { + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } + } catch { + throw $_ } } + + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/public/Repositories/Tags/Remove-GitHubRepositoryTagProtection.ps1 b/src/functions/public/Repositories/Tags/Remove-GitHubRepositoryTagProtection.ps1 index db1e9a30..82ae475a 100644 --- a/src/functions/public/Repositories/Tags/Remove-GitHubRepositoryTagProtection.ps1 +++ b/src/functions/public/Repositories/Tags/Remove-GitHubRepositoryTagProtection.ps1 @@ -38,27 +38,42 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner - } - Write-Debug "Owner : [$($Context.Owner)]" + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo + } + Write-Debug "Repo : [$($Context.Repo)]" } - Write-Debug "Repo : [$($Context.Repo)]" - $inputObject = @{ - Context = $Context - APIEndpoint = "/repos/$Owner/$Repo/tags/protection/$TagProtectionId" - Method = 'DELETE' - } + process { + try { + $inputObject = @{ + Context = $Context + APIEndpoint = "/repos/$Owner/$Repo/tags/protection/$TagProtectionId" + Method = 'DELETE' + } - if ($PSCmdlet.ShouldProcess("tag protection state with ID [$TagProtectionId] for repository [$Owner/$Repo]", 'Delete')) { - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + if ($PSCmdlet.ShouldProcess("tag protection state with ID [$TagProtectionId] for repository [$Owner/$Repo]", 'Delete')) { + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } + } catch { + throw $_ } } + + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/public/Status/Get-GitHubScheduledMaintenance.ps1 b/src/functions/public/Status/Get-GitHubScheduledMaintenance.ps1 index 76f7b1cd..4b3a5eda 100644 --- a/src/functions/public/Status/Get-GitHubScheduledMaintenance.ps1 +++ b/src/functions/public/Status/Get-GitHubScheduledMaintenance.ps1 @@ -49,23 +49,38 @@ [string] $Stamp = 'public' ) - $baseURL = $script:StatusBaseURL[$Stamp] - - if ($Active) { - $APIURI = "$baseURL/api/v2/scheduled-maintenances/active.json" - $response = Invoke-RestMethod -Uri $APIURI -Method Get - $response.scheduled_maintenances - return + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" } - if ($Upcoming) { - $APIURI = "$baseURL/api/v2/scheduled-maintenances/upcoming.json" - $response = Invoke-RestMethod -Uri $APIURI -Method Get - $response.scheduled_maintenances - return + process { + try { + $baseURL = $script:StatusBaseURL[$Stamp] + + if ($Active) { + $APIURI = "$baseURL/api/v2/scheduled-maintenances/active.json" + $response = Invoke-RestMethod -Uri $APIURI -Method Get + $response.scheduled_maintenances + return + } + + if ($Upcoming) { + $APIURI = "$baseURL/api/v2/scheduled-maintenances/upcoming.json" + $response = Invoke-RestMethod -Uri $APIURI -Method Get + $response.scheduled_maintenances + return + } + + $APIURI = "$baseURL/api/v2/scheduled-maintenances.json" + $response = Invoke-RestMethod -Uri $APIURI -Method Get + $response.scheduled_maintenances + } catch { + throw $_ + } } - $APIURI = "$baseURL/api/v2/scheduled-maintenances.json" - $response = Invoke-RestMethod -Uri $APIURI -Method Get - $response.scheduled_maintenances + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/public/Status/Get-GitHubStatus.ps1 b/src/functions/public/Status/Get-GitHubStatus.ps1 index 0100d0dc..7baeb675 100644 --- a/src/functions/public/Status/Get-GitHubStatus.ps1 +++ b/src/functions/public/Status/Get-GitHubStatus.ps1 @@ -38,17 +38,31 @@ [ValidateSet('public', 'eu')] [string] $Stamp = 'public' ) + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + } + + process { + try { + $baseURL = $script:StatusBaseURL[$Stamp] - $baseURL = $script:StatusBaseURL[$Stamp] + if ($Summary) { + $APIURI = "$baseURL/api/v2/summary.json" + $response = Invoke-RestMethod -Uri $APIURI -Method Get + $response + return + } - if ($Summary) { - $APIURI = "$baseURL/api/v2/summary.json" - $response = Invoke-RestMethod -Uri $APIURI -Method Get - $response - return + $APIURI = "$baseURL/api/v2/status.json" + $response = Invoke-RestMethod -Uri $APIURI -Method Get + $response.status + } catch { + throw $_ + } } - $APIURI = "$baseURL/api/v2/status.json" - $response = Invoke-RestMethod -Uri $APIURI -Method Get - $response.status + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/public/Status/Get-GitHubStatusComponent.ps1 b/src/functions/public/Status/Get-GitHubStatusComponent.ps1 index 157efd02..c142a145 100644 --- a/src/functions/public/Status/Get-GitHubStatusComponent.ps1 +++ b/src/functions/public/Status/Get-GitHubStatusComponent.ps1 @@ -25,9 +25,24 @@ [string] $Stamp = 'public' ) - $baseURL = $script:StatusBaseURL[$Stamp] + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + } - $APIURI = "$baseURL/api/v2/components.json" - $response = Invoke-RestMethod -Uri $APIURI -Method Get - $response.components + process { + try { + $baseURL = $script:StatusBaseURL[$Stamp] + + $APIURI = "$baseURL/api/v2/components.json" + $response = Invoke-RestMethod -Uri $APIURI -Method Get + $response.components + } catch { + throw $_ + } + } + + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/public/Status/Get-GitHubStatusIncident.ps1 b/src/functions/public/Status/Get-GitHubStatusIncident.ps1 index c8842822..472f13b1 100644 --- a/src/functions/public/Status/Get-GitHubStatusIncident.ps1 +++ b/src/functions/public/Status/Get-GitHubStatusIncident.ps1 @@ -38,16 +38,31 @@ [string] $Stamp = 'public' ) - $baseURL = $script:StatusBaseURL[$Stamp] + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + } + + process { + try { + $baseURL = $script:StatusBaseURL[$Stamp] - if ($Unresolved) { - $APIURI = "$baseURL/api/v2/incidents/unresolved.json" - $response = Invoke-RestMethod -Uri $APIURI -Method Get - $response.incidents - return + if ($Unresolved) { + $APIURI = "$baseURL/api/v2/incidents/unresolved.json" + $response = Invoke-RestMethod -Uri $APIURI -Method Get + $response.incidents + return + } + + $APIURI = "$baseURL/api/v2/incidents.json" + $response = Invoke-RestMethod -Uri $APIURI -Method Get + $response.incidents + } catch { + throw $_ + } } - $APIURI = "$baseURL/api/v2/incidents.json" - $response = Invoke-RestMethod -Uri $APIURI -Method Get - $response.incidents + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/public/Teams/Get-GitHubRepoTeam.ps1 b/src/functions/public/Teams/Get-GitHubRepoTeam.ps1 index d2fc4fb9..78c72b23 100644 --- a/src/functions/public/Teams/Get-GitHubRepoTeam.ps1 +++ b/src/functions/public/Teams/Get-GitHubRepoTeam.ps1 @@ -17,25 +17,40 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT - if ([string]::IsNullOrEmpty($Owner)) { - $Owner = $Context.Owner - } - Write-Debug "Owner : [$($Context.Owner)]" + if ([string]::IsNullOrEmpty($Owner)) { + $Owner = $Context.Owner + } + Write-Debug "Owner : [$($Context.Owner)]" - if ([string]::IsNullOrEmpty($Repo)) { - $Repo = $Context.Repo + if ([string]::IsNullOrEmpty($Repo)) { + $Repo = $Context.Repo + } + Write-Debug "Repo : [$($Context.Repo)]" } - Write-Debug "Repo : [$($Context.Repo)]" - $inputObject = @{ - Context = $Context - APIEndpoint = "/repos/$Owner/$Repo/teams" - Method = 'Get' + process { + try { + $inputObject = @{ + Context = $Context + APIEndpoint = "/repos/$Owner/$Repo/teams" + Method = 'Get' + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Teams/Get-GitHubTeamByName.ps1 b/src/functions/public/Teams/Get-GitHubTeamByName.ps1 index 1d235406..92ef57eb 100644 --- a/src/functions/public/Teams/Get-GitHubTeamByName.ps1 +++ b/src/functions/public/Teams/Get-GitHubTeamByName.ps1 @@ -32,20 +32,35 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT - if ([string]::IsNullOrEmpty($Owner)) { - $Organization = $Context.Owner + if ([string]::IsNullOrEmpty($Organization)) { + $Organization = $Context.Owner + } + Write-Debug "Organization : [$($Context.Owner)]" } - Write-Debug "Organization : [$($Context.Owner)]" - $inputObject = @{ - Context = $Context - APIEndpoint = "/orgs/$Organization/teams/$Name" - Method = 'Get' + process { + try { + $inputObject = @{ + Context = $Context + APIEndpoint = "/orgs/$Organization/teams/$Name" + Method = 'Get' + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Teams/Get-GitHubTeamListByOrg.ps1 b/src/functions/public/Teams/Get-GitHubTeamListByOrg.ps1 index f2f4d491..b477cea5 100644 --- a/src/functions/public/Teams/Get-GitHubTeamListByOrg.ps1 +++ b/src/functions/public/Teams/Get-GitHubTeamListByOrg.ps1 @@ -26,20 +26,35 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - if ([string]::IsNullOrEmpty($Owner)) { - $Organization = $Context.Owner + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + + if ([string]::IsNullOrEmpty($Organization)) { + $Organization = $Context.Owner + } + Write-Debug "Organization : [$($Context.Owner)]" } - Write-Debug "Organization : [$($Context.Owner)]" - $inputObject = @{ - Context = $Context - APIEndpoint = "/orgs/$Organization/teams" - Method = 'Get' + process { + try { + $inputObject = @{ + Context = $Context + APIEndpoint = "/orgs/$Organization/teams" + Method = 'Get' + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Teams/New-GitHubTeam.ps1 b/src/functions/public/Teams/New-GitHubTeam.ps1 index f91c0778..f55edb1b 100644 --- a/src/functions/public/Teams/New-GitHubTeam.ps1 +++ b/src/functions/public/Teams/New-GitHubTeam.ps1 @@ -85,35 +85,49 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - if ([string]::IsNullOrEmpty($Owner)) { - $Organization = $Context.Owner - } - Write-Debug "Organization : [$($Context.Owner)]" - - $body = @{ - name = $Name - description = $Description - maintainers = $Maintainers - repo_names = $RepoNames - privacy = $Privacy - notification_setting = $NotificationSetting - permission = $Permission - parent_team_id = $ParentTeamID -eq 0 ? $null : $ParentTeamID + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + + if ([string]::IsNullOrEmpty($Organization)) { + $Organization = $Context.Owner + } + Write-Debug "Organization : [$($Context.Owner)]" } - $body | Remove-HashtableEntry -NullOrEmptyValues - $inputObject = @{ - Context = $Context - APIEndpoint = "/orgs/$Organization/teams" - Method = 'POST' - Body = $body + process { + try { + $body = @{ + name = $Name + description = $Description + maintainers = $Maintainers + repo_names = $RepoNames + privacy = $Privacy + notification_setting = $NotificationSetting + permission = $Permission + parent_team_id = $ParentTeamID -eq 0 ? $null : $ParentTeamID + } | Remove-HashtableEntry -NullOrEmptyValues + + $inputObject = @{ + Context = $Context + APIEndpoint = "/orgs/$Organization/teams" + Method = 'POST' + Body = $body + } + + if ($PSCmdlet.ShouldProcess("'$Name' in '$Organization'", 'Create team')) { + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } + } catch { + throw $_ + } } - if ($PSCmdlet.ShouldProcess("'$Name' in '$Organization'", 'Create team')) { - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response - } + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Teams/Remove-GitHubTeam.ps1 b/src/functions/public/Teams/Remove-GitHubTeam.ps1 index 81a5cc49..140ff7ef 100644 --- a/src/functions/public/Teams/Remove-GitHubTeam.ps1 +++ b/src/functions/public/Teams/Remove-GitHubTeam.ps1 @@ -32,22 +32,37 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT - if ([string]::IsNullOrEmpty($Owner)) { - $Organization = $Context.Owner + if ([string]::IsNullOrEmpty($Organization)) { + $Organization = $Context.Owner + } + Write-Debug "Organization : [$($Context.Owner)]" } - Write-Debug "Organization : [$($Context.Owner)]" - $inputObject = @{ - Context = $Context - Method = 'Delete' - APIEndpoint = "/orgs/$Organization/teams/$Name" - } + process { + try { + $inputObject = @{ + Context = $Context + Method = 'Delete' + APIEndpoint = "/orgs/$Organization/teams/$Name" + } - if ($PSCmdlet.ShouldProcess("$Organization/$Name", 'Delete')) { - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + if ($PSCmdlet.ShouldProcess("$Organization/$Name", 'Delete')) { + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } + } catch { + throw $_ } } + + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/public/Teams/Update-GitHubTeam.ps1 b/src/functions/public/Teams/Update-GitHubTeam.ps1 index ba3a02ae..b5bae152 100644 --- a/src/functions/public/Teams/Update-GitHubTeam.ps1 +++ b/src/functions/public/Teams/Update-GitHubTeam.ps1 @@ -79,33 +79,47 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - if ([string]::IsNullOrEmpty($Owner)) { - $Organization = $Context.Owner - } - Write-Debug "Organization : [$($Context.Owner)]" - - $body = @{ - name = $NewName - description = $Description - privacy = $Privacy - notification_setting = $NotificationSetting - permission = $Permission - parent_team_id = $ParentTeamID + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + + if ([string]::IsNullOrEmpty($Organization)) { + $Organization = $Context.Owner + } + Write-Debug "Organization : [$($Context.Owner)]" } - $body | Remove-HashtableEntry -NullOrEmptyValues - $inputObject = @{ - Context = $Context - APIEndpoint = "/orgs/$Organization/teams/$Name" - Method = 'Patch' - Body = $body + process { + try { + $body = @{ + name = $NewName + description = $Description + privacy = $Privacy + notification_setting = $NotificationSetting + permission = $Permission + parent_team_id = $ParentTeamID + } | Remove-HashtableEntry -NullOrEmptyValues + + $inputObject = @{ + Context = $Context + APIEndpoint = "/orgs/$Organization/teams/$Name" + Method = 'Patch' + Body = $body + } + + if ($PSCmdlet.ShouldProcess("$Organization/$Name", 'Update')) { + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } + } catch { + throw $_ + } } - if ($PSCmdlet.ShouldProcess("$Organization/$Name", 'Update')) { - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response - } + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Users/Blocking/Block-GitHubUser.ps1 b/src/functions/public/Users/Blocking/Block-GitHubUser.ps1 index 890f97f3..16c61383 100644 --- a/src/functions/public/Users/Blocking/Block-GitHubUser.ps1 +++ b/src/functions/public/Users/Blocking/Block-GitHubUser.ps1 @@ -24,21 +24,22 @@ [Block a user from an organization](https://docs.github.com/rest/orgs/blocking#block-a-user-from-an-organization) #> [OutputType([bool])] - [CmdletBinding()] + [CmdletBinding(DefaultParameterSetName = '__AllParameterSets')] param( # The handle for the GitHub user account. [Parameter( - Mandatory, - ValueFromPipeline, - ValueFromPipelineByPropertyName + Mandatory )] [Alias('login')] [string] $Username, # The organization name. The name is not case sensitive. [Parameter( - ValueFromPipeline, - ValueFromPipelineByPropertyName + Mandatory, + ParameterSetName = 'Organization' + )] + [Parameter( + ParameterSetName = '__AllParameterSets' )] [Alias('org')] [Alias('owner')] @@ -50,16 +51,29 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + } - if ([string]::IsNullOrEmpty($Owner)) { - $Organization = $Context.Owner + process { + try { + switch ($PSCmdlet.ParameterSetName) { + 'Organization' { + Block-GitHubUserByOrganization -Organization $Organization -Username $Username -Context $Context + } + '__AllParameterSets' { + Block-GitHubUserByUser -Username $Username -Context $Context + } + } + } catch { + throw $_ + } } - Write-Debug "Organization : [$($Context.Owner)]" - if ($Organization) { - Block-GitHubUserByOrganization -Organization $Organization -Username $Username -Context $Context - } else { - Block-GitHubUserByUser -Username $Username -Context $Context + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Users/Blocking/Get-GitHubBlockedUser.ps1 b/src/functions/public/Users/Blocking/Get-GitHubBlockedUser.ps1 index d9bb7698..bc598058 100644 --- a/src/functions/public/Users/Blocking/Get-GitHubBlockedUser.ps1 +++ b/src/functions/public/Users/Blocking/Get-GitHubBlockedUser.ps1 @@ -44,17 +44,31 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT - if ([string]::IsNullOrEmpty($Owner)) { - $Organization = $Context.Owner + if ([string]::IsNullOrEmpty($Organization)) { + $Organization = $Context.Owner + } + Write-Debug "Organization : [$($Context.Owner)]" } - Write-Debug "Organization : [$($Context.Owner)]" - if ($Organization) { - Get-GitHubBlockedUserByOrganization -Organization $Organization -PerPage $PerPage -Context $Context - } else { - Get-GitHubBlockedUserByUser -PerPage $PerPage -Context $Context + process { + try { + if ($Organization) { + Get-GitHubBlockedUserByOrganization -Organization $Organization -PerPage $PerPage -Context $Context + } else { + Get-GitHubBlockedUserByUser -PerPage $PerPage -Context $Context + } + } catch { + throw $_ + } } + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/public/Users/Blocking/Test-GitHubBlockedUser.ps1 b/src/functions/public/Users/Blocking/Test-GitHubBlockedUser.ps1 index 466f2d02..09e4d7d3 100644 --- a/src/functions/public/Users/Blocking/Test-GitHubBlockedUser.ps1 +++ b/src/functions/public/Users/Blocking/Test-GitHubBlockedUser.ps1 @@ -56,16 +56,31 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT - if ([string]::IsNullOrEmpty($Owner)) { - $Organization = $Context.Owner + if ([string]::IsNullOrEmpty($Organization)) { + $Organization = $Context.Owner + } + Write-Debug "Organization : [$($Context.Owner)]" } - Write-Debug "Organization : [$($Context.Owner)]" - if ($Organization) { - Test-GitHubBlockedUserByOrganization -Organization $Organization -Username $Username -PerPage $PerPage -Context $Context - } else { - Test-GitHubBlockedUserByUser -Username $Username -PerPage $PerPage -Context $Context + process { + try { + if ($Organization) { + Test-GitHubBlockedUserByOrganization -Organization $Organization -Username $Username -PerPage $PerPage -Context $Context + } else { + Test-GitHubBlockedUserByUser -Username $Username -PerPage $PerPage -Context $Context + } + } catch { + throw $_ + } + } + + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Users/Blocking/Unblock-GitHubUser.ps1 b/src/functions/public/Users/Blocking/Unblock-GitHubUser.ps1 index b25ffa90..bd3826eb 100644 --- a/src/functions/public/Users/Blocking/Unblock-GitHubUser.ps1 +++ b/src/functions/public/Users/Blocking/Unblock-GitHubUser.ps1 @@ -49,16 +49,31 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT - if ([string]::IsNullOrEmpty($Owner)) { - $Organization = $Context.Owner + if ([string]::IsNullOrEmpty($Organization)) { + $Organization = $Context.Owner + } + Write-Debug "Organization : [$($Context.Owner)]" } - Write-Debug "Organization : [$($Context.Owner)]" - if ($Organization) { - Unblock-GitHubUserByOrganization -Organization $Organization -Username $Username -Context $Context - } else { - Unblock-GitHubUserByUser -Username $Username -Context $Context + process { + try { + if ($Organization) { + Unblock-GitHubUserByOrganization -Organization $Organization -Username $Username -Context $Context + } else { + Unblock-GitHubUserByUser -Username $Username -Context $Context + } + } catch { + throw $_ + } + } + + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Users/Emails/Add-GitHubUserEmail.ps1 b/src/functions/public/Users/Emails/Add-GitHubUserEmail.ps1 index 6391b20a..8fc6e8de 100644 --- a/src/functions/public/Users/Emails/Add-GitHubUserEmail.ps1 +++ b/src/functions/public/Users/Emails/Add-GitHubUserEmail.ps1 @@ -35,21 +35,35 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - $body = @{ - emails = $Emails + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } - $inputObject = @{ - Context = $Context - APIEndpoint = '/user/emails' - Method = 'POST' - Body = $body - } + process { + try { + $body = @{ + emails = $Emails + } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + $inputObject = @{ + Context = $Context + APIEndpoint = '/user/emails' + Method = 'POST' + Body = $body + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/public/Users/Emails/Get-GitHubUserEmail.ps1 b/src/functions/public/Users/Emails/Get-GitHubUserEmail.ps1 index 4d80654e..a8030f74 100644 --- a/src/functions/public/Users/Emails/Get-GitHubUserEmail.ps1 +++ b/src/functions/public/Users/Emails/Get-GitHubUserEmail.ps1 @@ -41,11 +41,26 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + } + + process { + try { + if ($Public) { + Get-GitHubUserPublicEmail -PerPage $PerPage -Context $Context + } else { + Get-GitHubUserAllEmail -PerPage $PerPage -Context $Context + } + } catch { + throw $_ + } + } - if ($Public) { - Get-GitHubUserPublicEmail -PerPage $PerPage -Context $Context - } else { - Get-GitHubUserAllEmail -PerPage $PerPage -Context $Context + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Users/Emails/Remove-GitHubUserEmail.ps1 b/src/functions/public/Users/Emails/Remove-GitHubUserEmail.ps1 index 2f9f2a2f..29186ed2 100644 --- a/src/functions/public/Users/Emails/Remove-GitHubUserEmail.ps1 +++ b/src/functions/public/Users/Emails/Remove-GitHubUserEmail.ps1 @@ -33,23 +33,37 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - $body = @{ - emails = $Emails + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } - $inputObject = @{ - Context = $Context - APIEndpoint = '/user/emails' - Method = 'DELETE' - Body = $body - } + process { + try { + $body = @{ + emails = $Emails + } - if ($PSCmdlet.ShouldProcess("Email addresses [$($Emails -join ', ')]", 'Delete')) { - $null = Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + $inputObject = @{ + Context = $Context + APIEndpoint = '/user/emails' + Method = 'DELETE' + Body = $body + } + + if ($PSCmdlet.ShouldProcess("Email addresses [$($Emails -join ', ')]", 'Delete')) { + $null = Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } + } catch { + throw $_ } } + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/public/Users/Emails/Set-GitHubUserEmailVisibility.ps1 b/src/functions/public/Users/Emails/Set-GitHubUserEmailVisibility.ps1 index 9c807806..c1a66ea8 100644 --- a/src/functions/public/Users/Emails/Set-GitHubUserEmailVisibility.ps1 +++ b/src/functions/public/Users/Emails/Set-GitHubUserEmailVisibility.ps1 @@ -39,23 +39,37 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - $body = @{ - visibility = $Visibility + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } - $inputObject = @{ - Context = $Context - APIEndpoint = '/user/email/visibility' - Method = 'PATCH' - Body = $body - } + process { + try { + $body = @{ + visibility = $Visibility + } - if ($PSCmdlet.ShouldProcess("Email visibility [$Visibility]", 'Set')) { - $null = Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + $inputObject = @{ + Context = $Context + APIEndpoint = '/user/email/visibility' + Method = 'PATCH' + Body = $body + } + + if ($PSCmdlet.ShouldProcess("Email visibility [$Visibility]", 'Set')) { + $null = Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } + } catch { + throw $_ } } + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/public/Users/Followers/Add-GitHubUserFollowing.ps1 b/src/functions/public/Users/Followers/Add-GitHubUserFollowing.ps1 index dc92f030..1df07235 100644 --- a/src/functions/public/Users/Followers/Add-GitHubUserFollowing.ps1 +++ b/src/functions/public/Users/Followers/Add-GitHubUserFollowing.ps1 @@ -35,16 +35,30 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - $inputObject = @{ - Context = $Context - APIEndpoint = "/user/following/$Username" - Method = 'PUT' + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } - $null = Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + process { + try { + $inputObject = @{ + Context = $Context + APIEndpoint = "/user/following/$Username" + Method = 'PUT' + } + + $null = Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/public/Users/Followers/Get-GitHubUserFollower.ps1 b/src/functions/public/Users/Followers/Get-GitHubUserFollower.ps1 index fd880a30..4a65b222 100644 --- a/src/functions/public/Users/Followers/Get-GitHubUserFollower.ps1 +++ b/src/functions/public/Users/Followers/Get-GitHubUserFollower.ps1 @@ -42,11 +42,26 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + } + + process { + try { + if ($Username) { + Get-GitHubUserFollowersOfUser -Username $Username -PerPage $PerPage -Context $Context + } else { + Get-GitHubUserMyFollowers -PerPage $PerPage -Context $Context + } + } catch { + throw $_ + } + } - if ($Username) { - Get-GitHubUserFollowersOfUser -Username $Username -PerPage $PerPage -Context $Context - } else { - Get-GitHubUserMyFollowers -PerPage $PerPage -Context $Context + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Users/Followers/Get-GitHubUserFollowing.ps1 b/src/functions/public/Users/Followers/Get-GitHubUserFollowing.ps1 index 9a60fc64..9e5b4e6f 100644 --- a/src/functions/public/Users/Followers/Get-GitHubUserFollowing.ps1 +++ b/src/functions/public/Users/Followers/Get-GitHubUserFollowing.ps1 @@ -43,11 +43,26 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + } + + process { + try { + if ($Username) { + Get-GitHubUserFollowingUser -Username $Username -PerPage $PerPage -Context $Context + } else { + Get-GitHubUserFollowingMe -PerPage $PerPage -Context $Context + } + } catch { + throw $_ + } + } - if ($Username) { - Get-GitHubUserFollowingUser -Username $Username -PerPage $PerPage -Context $Context - } else { - Get-GitHubUserFollowingMe -PerPage $PerPage -Context $Context + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Users/Followers/Remove-GitHubUserFollowing.ps1 b/src/functions/public/Users/Followers/Remove-GitHubUserFollowing.ps1 index 45197b69..7545273a 100644 --- a/src/functions/public/Users/Followers/Remove-GitHubUserFollowing.ps1 +++ b/src/functions/public/Users/Followers/Remove-GitHubUserFollowing.ps1 @@ -32,17 +32,32 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - $inputObject = @{ - Context = $Context - APIEndpoint = "/user/following/$Username" - Method = 'DELETE' + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } - if ($PSCmdlet.ShouldProcess("User [$Username]", 'Unfollow')) { - $null = Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + process { + try { + $inputObject = @{ + Context = $Context + APIEndpoint = "/user/following/$Username" + Method = 'DELETE' + } + + if ($PSCmdlet.ShouldProcess("User [$Username]", 'Unfollow')) { + $null = Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } + } catch { + throw $_ } } + + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/public/Users/Followers/Test-GitHubUserFollowing.ps1 b/src/functions/public/Users/Followers/Test-GitHubUserFollowing.ps1 index 0bc1ff3d..b015ea40 100644 --- a/src/functions/public/Users/Followers/Test-GitHubUserFollowing.ps1 +++ b/src/functions/public/Users/Followers/Test-GitHubUserFollowing.ps1 @@ -49,11 +49,26 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + } + + process { + try { + if ($Username) { + Test-GitHubUserFollowedByUser -Username $Username -Follows $Follows -Context $Context + } else { + Test-GitHubUserFollowedByMe -Username $Follows -Context $Context + } + } catch { + throw $_ + } + } - if ($Username) { - Test-GitHubUserFollowedByUser -Username $Username -Follows $Follows -Context $Context - } else { - Test-GitHubUserFollowedByMe -Username $Follows -Context $Context + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Users/GPG-Keys/Add-GitHubUserGpgKey.ps1 b/src/functions/public/Users/GPG-Keys/Add-GitHubUserGpgKey.ps1 index 9789b5ed..678cf71b 100644 --- a/src/functions/public/Users/GPG-Keys/Add-GitHubUserGpgKey.ps1 +++ b/src/functions/public/Users/GPG-Keys/Add-GitHubUserGpgKey.ps1 @@ -48,21 +48,36 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - $body = @{ - name = $Name - armored_public_key = $ArmoredPublicKey + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } - $inputObject = @{ - Context = $Context - APIEndpoint = '/user/gpg_keys' - Method = 'POST' - Body = $body + process { + try { + $body = @{ + name = $Name + armored_public_key = $ArmoredPublicKey + } + + $inputObject = @{ + Context = $Context + APIEndpoint = '/user/gpg_keys' + Method = 'POST' + Body = $body + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Users/GPG-Keys/Get-GitHubUserGpgKey.ps1 b/src/functions/public/Users/GPG-Keys/Get-GitHubUserGpgKey.ps1 index 039e82d3..3d5410f0 100644 --- a/src/functions/public/Users/GPG-Keys/Get-GitHubUserGpgKey.ps1 +++ b/src/functions/public/Users/GPG-Keys/Get-GitHubUserGpgKey.ps1 @@ -55,15 +55,30 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + } - if ($Username) { - Get-GitHubUserGpgKeyForUser -Username $Username -PerPage $PerPage -Context $Context - } else { - if ($ID) { - Get-GitHubUserMyGpgKeyById -ID $ID -Context $Context - } else { - Get-GitHubUserMyGpgKey -PerPage $PerPage -Context $Context + process { + try { + if ($Username) { + Get-GitHubUserGpgKeyForUser -Username $Username -PerPage $PerPage -Context $Context + } else { + if ($ID) { + Get-GitHubUserMyGpgKeyById -ID $ID -Context $Context + } else { + Get-GitHubUserMyGpgKey -PerPage $PerPage -Context $Context + } + } + } catch { + throw $_ } } + + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/public/Users/GPG-Keys/Remove-GitHubUserGpgKey.ps1 b/src/functions/public/Users/GPG-Keys/Remove-GitHubUserGpgKey.ps1 index 6f70e07b..ee9ab51a 100644 --- a/src/functions/public/Users/GPG-Keys/Remove-GitHubUserGpgKey.ps1 +++ b/src/functions/public/Users/GPG-Keys/Remove-GitHubUserGpgKey.ps1 @@ -33,17 +33,32 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - $inputObject = @{ - Context = $Context - APIEndpoint = "/user/gpg_keys/$ID" - Method = 'DELETE' + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } - if ($PSCmdlet.ShouldProcess("GPG key with ID [$ID]", 'Delete')) { - $null = Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + process { + try { + $inputObject = @{ + Context = $Context + APIEndpoint = "/user/gpg_keys/$ID" + Method = 'DELETE' + } + + if ($PSCmdlet.ShouldProcess("GPG key with ID [$ID]", 'Delete')) { + $null = Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } + } catch { + throw $_ } } + + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/public/Users/Get-GitHubUser.ps1 b/src/functions/public/Users/Get-GitHubUser.ps1 index 94115fcd..dc6f1195 100644 --- a/src/functions/public/Users/Get-GitHubUser.ps1 +++ b/src/functions/public/Users/Get-GitHubUser.ps1 @@ -64,23 +64,38 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + } - switch ($PSCmdlet.ParameterSetName) { - '__DefaultSet' { - $user = Get-GitHubMyUser -Context $Context - $social_accounts = Get-GitHubMyUserSocials -Context $Context - $user | Add-Member -MemberType NoteProperty -Name 'social_accounts' -Value $social_accounts -Force - $user - } - 'NamedUser' { - $user = Get-GitHubUserByName -Username $Username -Context $Context - $social_accounts = Get-GitHubUserSocialsByName -Username $Username -Context $Context - $user | Add-Member -MemberType NoteProperty -Name 'social_accounts' -Value $social_accounts -Force - $user - } - 'AllUsers' { - Get-GitHubAllUsers -Since $Since -PerPage $PerPage -Context $Context + process { + try { + switch ($PSCmdlet.ParameterSetName) { + '__DefaultSet' { + $user = Get-GitHubMyUser -Context $Context + $social_accounts = Get-GitHubMyUserSocials -Context $Context + $user | Add-Member -MemberType NoteProperty -Name 'social_accounts' -Value $social_accounts -Force + $user + } + 'NamedUser' { + $user = Get-GitHubUserByName -Username $Username -Context $Context + $social_accounts = Get-GitHubUserSocialsByName -Username $Username -Context $Context + $user | Add-Member -MemberType NoteProperty -Name 'social_accounts' -Value $social_accounts -Force + $user + } + 'AllUsers' { + Get-GitHubAllUsers -Since $Since -PerPage $PerPage -Context $Context + } + } + } catch { + throw $_ } } + + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/public/Users/Get-GitHubUserCard.ps1 b/src/functions/public/Users/Get-GitHubUserCard.ps1 index 74ac00a1..0afa2e6c 100644 --- a/src/functions/public/Users/Get-GitHubUserCard.ps1 +++ b/src/functions/public/Users/Get-GitHubUserCard.ps1 @@ -45,21 +45,36 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - $body = @{ - subject_type = $SubjectType - subject_id = $SubjectID + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } - $inputObject = @{ - Context = $Context - APIEndpoint = "/users/$Username/hovercard" - Method = 'GET' - Body = $body + process { + try { + $body = @{ + subject_type = $SubjectType + subject_id = $SubjectID + } + + $inputObject = @{ + Context = $Context + APIEndpoint = "/users/$Username/hovercard" + Method = 'GET' + Body = $body + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Users/Keys/Add-GitHubUserKey.ps1 b/src/functions/public/Users/Keys/Add-GitHubUserKey.ps1 index ca015268..1713495a 100644 --- a/src/functions/public/Users/Keys/Add-GitHubUserKey.ps1 +++ b/src/functions/public/Users/Keys/Add-GitHubUserKey.ps1 @@ -42,21 +42,36 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - $body = @{ - title = $Title - key = $Key + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } - $inputObject = @{ - Context = $Context - APIEndpoint = '/user/keys' - Method = 'POST' - Body = $body + process { + try { + $body = @{ + title = $Title + key = $Key + } + + $inputObject = @{ + Context = $Context + APIEndpoint = '/user/keys' + Method = 'POST' + Body = $body + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Users/Keys/Get-GitHubUserKey.ps1 b/src/functions/public/Users/Keys/Get-GitHubUserKey.ps1 index 5605ec71..05a4fa0f 100644 --- a/src/functions/public/Users/Keys/Get-GitHubUserKey.ps1 +++ b/src/functions/public/Users/Keys/Get-GitHubUserKey.ps1 @@ -58,15 +58,30 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + } - if ($Username) { - Get-GitHubUserKeyForUser -Username $Username -PerPage $PerPage -Context $Context - } else { - if ($ID) { - Get-GitHubUserMyKeyById -ID $ID -Context $Context - } else { - Get-GitHubUserMyKey -PerPage $PerPage -Context $Context + process { + try { + if ($Username) { + Get-GitHubUserKeyForUser -Username $Username -PerPage $PerPage -Context $Context + } else { + if ($ID) { + Get-GitHubUserMyKeyById -ID $ID -Context $Context + } else { + Get-GitHubUserMyKey -PerPage $PerPage -Context $Context + } + } + } catch { + throw $_ } } + + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/public/Users/Keys/Remove-GitHubUserKey.ps1 b/src/functions/public/Users/Keys/Remove-GitHubUserKey.ps1 index b69a2888..54491231 100644 --- a/src/functions/public/Users/Keys/Remove-GitHubUserKey.ps1 +++ b/src/functions/public/Users/Keys/Remove-GitHubUserKey.ps1 @@ -34,17 +34,32 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - $inputObject = @{ - Context = $Context - APIEndpoint = "/user/keys/$ID" - Method = 'DELETE' + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } - if ($PSCmdlet.ShouldProcess("Key with ID [$ID]", 'Delete')) { - $null = Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + process { + try { + $inputObject = @{ + Context = $Context + APIEndpoint = "/user/keys/$ID" + Method = 'DELETE' + } + + if ($PSCmdlet.ShouldProcess("Key with ID [$ID]", 'Delete')) { + $null = Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } + } catch { + throw $_ } } + + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/public/Users/SSH-Signing-Keys/Add-GitHubUserSigningKey.ps1 b/src/functions/public/Users/SSH-Signing-Keys/Add-GitHubUserSigningKey.ps1 index 82f2350b..5857a722 100644 --- a/src/functions/public/Users/SSH-Signing-Keys/Add-GitHubUserSigningKey.ps1 +++ b/src/functions/public/Users/SSH-Signing-Keys/Add-GitHubUserSigningKey.ps1 @@ -44,21 +44,36 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - $body = @{ - title = $Title - key = $Key + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } - $inputObject = @{ - Context = $Context - APIEndpoint = '/user/ssh_signing_keys' - Method = 'POST' - Body = $body + process { + try { + $body = @{ + title = $Title + key = $Key + } + + $inputObject = @{ + Context = $Context + APIEndpoint = '/user/ssh_signing_keys' + Method = 'POST' + Body = $body + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Users/SSH-Signing-Keys/Get-GitHubUserSigningKey.ps1 b/src/functions/public/Users/SSH-Signing-Keys/Get-GitHubUserSigningKey.ps1 index 9a72c78c..1e9c47b4 100644 --- a/src/functions/public/Users/SSH-Signing-Keys/Get-GitHubUserSigningKey.ps1 +++ b/src/functions/public/Users/SSH-Signing-Keys/Get-GitHubUserSigningKey.ps1 @@ -58,15 +58,30 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + } - if ($Username) { - Get-GitHubUserSigningKeyForUser -Username $Username -PerPage $PerPage -Context $Context - } else { - if ($ID) { - Get-GitHubUserMySigningKeyById -ID $ID -Context $Context - } else { - Get-GitHubUserMySigningKey -PerPage $PerPage -Context $Context + process { + try { + if ($Username) { + Get-GitHubUserSigningKeyForUser -Username $Username -PerPage $PerPage -Context $Context + } else { + if ($ID) { + Get-GitHubUserMySigningKeyById -ID $ID -Context $Context + } else { + Get-GitHubUserMySigningKey -PerPage $PerPage -Context $Context + } + } + } catch { + throw $_ } } + + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/public/Users/SSH-Signing-Keys/Remove-GitHubUserSigningKey.ps1 b/src/functions/public/Users/SSH-Signing-Keys/Remove-GitHubUserSigningKey.ps1 index 113cedaf..a2c60221 100644 --- a/src/functions/public/Users/SSH-Signing-Keys/Remove-GitHubUserSigningKey.ps1 +++ b/src/functions/public/Users/SSH-Signing-Keys/Remove-GitHubUserSigningKey.ps1 @@ -35,17 +35,32 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - $inputObject = @{ - Context = $Context - APIEndpoint = "/user/ssh_signing_keys/$ID" - Method = 'DELETE' + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } - if ($PSCmdlet.ShouldProcess("SSH signing key with ID [$ID]", 'Delete')) { - $null = Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + process { + try { + $inputObject = @{ + Context = $Context + APIEndpoint = "/user/ssh_signing_keys/$ID" + Method = 'DELETE' + } + + if ($PSCmdlet.ShouldProcess("SSH signing key with ID [$ID]", 'Delete')) { + $null = Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } + } catch { + throw $_ } } + + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/public/Users/Set-GitHubUser.ps1 b/src/functions/public/Users/Set-GitHubUser.ps1 index f89e3ecd..089265a5 100644 --- a/src/functions/public/Users/Set-GitHubUser.ps1 +++ b/src/functions/public/Users/Set-GitHubUser.ps1 @@ -68,29 +68,44 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - $body = @{ - name = $Name - email = $Email - blog = $Blog - twitter_username = $TwitterUsername - company = $Company - location = $Location - hireable = $Hireable - bio = $Bio + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } - $inputObject = @{ - Context = $Context - APIEndpoint = '/user' - Method = 'PATCH' - Body = $body + process { + try { + $body = @{ + name = $Name + email = $Email + blog = $Blog + twitter_username = $TwitterUsername + company = $Company + location = $Location + hireable = $Hireable + bio = $Bio + } + + $inputObject = @{ + Context = $Context + APIEndpoint = '/user' + Method = 'PATCH' + Body = $body + } + + if ($PSCmdlet.ShouldProcess('authenticated user', 'Set')) { + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } + } catch { + throw $_ + } } - if ($PSCmdlet.ShouldProcess('authenticated user', 'Set')) { - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response - } + end { + Write-Debug "[$commandName] - End" } } diff --git a/src/functions/public/Users/Social-Accounts/Add-GitHubUserSocial.ps1 b/src/functions/public/Users/Social-Accounts/Add-GitHubUserSocial.ps1 index 48ac0606..e75699b9 100644 --- a/src/functions/public/Users/Social-Accounts/Add-GitHubUserSocial.ps1 +++ b/src/functions/public/Users/Social-Accounts/Add-GitHubUserSocial.ps1 @@ -30,21 +30,35 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - $body = @{ - account_urls = $AccountUrls + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } - $inputObject = @{ - Context = $Context - APIEndpoint = '/user/social_accounts' - Body = $body - Method = 'POST' - } + process { + try { + $body = @{ + account_urls = $AccountUrls + } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + $inputObject = @{ + Context = $Context + APIEndpoint = '/user/social_accounts' + Body = $body + Method = 'POST' + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } catch { + throw $_ + } } + end { + Write-Debug "[$commandName] - End" + } } diff --git a/src/functions/public/Users/Social-Accounts/Remove-GitHubUserSocial.ps1 b/src/functions/public/Users/Social-Accounts/Remove-GitHubUserSocial.ps1 index ac548a43..9f5f6172 100644 --- a/src/functions/public/Users/Social-Accounts/Remove-GitHubUserSocial.ps1 +++ b/src/functions/public/Users/Social-Accounts/Remove-GitHubUserSocial.ps1 @@ -31,22 +31,37 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - $body = @{ - account_urls = $AccountUrls + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Debug "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } - $inputObject = @{ - Context = $Context - APIEndpoint = '/user/social_accounts' - Body = $body - Method = 'DELETE' - } + process { + try { + $body = @{ + account_urls = $AccountUrls + } + + $inputObject = @{ + Context = $Context + APIEndpoint = '/user/social_accounts' + Body = $body + Method = 'DELETE' + } - if ($PSCmdlet.ShouldProcess("Social accounts [$($AccountUrls -join ', ')]", 'Delete')) { - $null = Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + if ($PSCmdlet.ShouldProcess("Social accounts [$($AccountUrls -join ', ')]", 'Delete')) { + $null = Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } + } catch { + throw $_ } } + + end { + Write-Debug "[$commandName] - End" + } } diff --git a/tools/utilities/GitHubAPI.ps1 b/tools/utilities/GitHubAPI.ps1 index 05baf5dd..956966d5 100644 --- a/tools/utilities/GitHubAPI.ps1 +++ b/tools/utilities/GitHubAPI.ps1 @@ -21,8 +21,8 @@ $response = Invoke-RestMethod -Uri $APIDocURI -Method Get # @{n = 'PUT'; e = { (($_.value.psobject.Properties.Name) -contains 'PUT') } }, ` # @{n = 'PATCH'; e = { (($_.value.psobject.Properties.Name) -contains 'PATCH') } } | Format-Table -$path = '/repos/{owner}/{repo}/actions/runs' -$method = 'GET' +$path = '/markdown/raw' +$method = 'post' $response.paths.$path.$method $response.paths.$path.$method.tags | clip # -> Namespace/foldername $response.paths.$path.$method.operationId | clip # -> FunctionName From 7cec758610358be0e6a4c1bf17daa3afcefb0b97 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sun, 15 Dec 2024 15:34:58 +0100 Subject: [PATCH 08/24] Correct capitalization of "Markdown" and "HTML" in documentation comments for consistency --- src/functions/public/Markdown/Get-GitHubMarkdown.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/functions/public/Markdown/Get-GitHubMarkdown.ps1 b/src/functions/public/Markdown/Get-GitHubMarkdown.ps1 index ffbe4dec..d09230e2 100644 --- a/src/functions/public/Markdown/Get-GitHubMarkdown.ps1 +++ b/src/functions/public/Markdown/Get-GitHubMarkdown.ps1 @@ -4,13 +4,13 @@ Render a Markdown document .DESCRIPTION - Converts markdown to html + Converts Markdown to HTML .EXAMPLE Get-GitHubMarkdown -Text "Hello **world**" "

Hello world

" - Renders the markdown text "Hello **world**" to HTML. + Renders the Markdown text "Hello **world**" to HTML. .NOTES [Render a Markdown document](https://docs.github.com/en/rest/markdown/markdown#render-a-markdown-document) From fda9d2fc58d4778b68f00cbf009902dd374327e1 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sun, 15 Dec 2024 16:10:05 +0100 Subject: [PATCH 09/24] Remove redundant Assert-GitHubContext call in Get-GitHubApp function --- src/functions/public/Apps/GitHub Apps/Get-GitHubApp.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/functions/public/Apps/GitHub Apps/Get-GitHubApp.ps1 b/src/functions/public/Apps/GitHub Apps/Get-GitHubApp.ps1 index 41ab6183..fba1a6ea 100644 --- a/src/functions/public/Apps/GitHub Apps/Get-GitHubApp.ps1 +++ b/src/functions/public/Apps/GitHub Apps/Get-GitHubApp.ps1 @@ -43,7 +43,7 @@ $commandName = $MyInvocation.MyCommand.Name Write-Debug "[$commandName] - Start" $Context = Resolve-GitHubContext -Context $Context - Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT + if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } From cb9c22f55d260e584e75d1d6d8fc69e05bd6139d Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sun, 15 Dec 2024 16:39:50 +0100 Subject: [PATCH 10/24] test --- .../public/Git/Get-GitHubGitConfig.ps1 | 1 - .../Repositories/Get-GitHubRepository.ps1 | 18 ++++++------------ 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/src/functions/public/Git/Get-GitHubGitConfig.ps1 b/src/functions/public/Git/Get-GitHubGitConfig.ps1 index 8aba0ec8..0a2b01f3 100644 --- a/src/functions/public/Git/Get-GitHubGitConfig.ps1 +++ b/src/functions/public/Git/Get-GitHubGitConfig.ps1 @@ -18,7 +18,6 @@ begin { $commandName = $MyInvocation.MyCommand.Name Write-Debug "[$commandName] - Start" - $Context = Resolve-GitHubContext -Context $Context } process { diff --git a/src/functions/public/Repositories/Repositories/Get-GitHubRepository.ps1 b/src/functions/public/Repositories/Repositories/Get-GitHubRepository.ps1 index a7cb7c8e..58ccf5b1 100644 --- a/src/functions/public/Repositories/Repositories/Get-GitHubRepository.ps1 +++ b/src/functions/public/Repositories/Repositories/Get-GitHubRepository.ps1 @@ -192,8 +192,7 @@ filter Get-GitHubRepository { PerPage = $PerPage Since = $Since Before = $Before - } - Remove-HashtableEntry -Hashtable $params -NullOrEmptyValues + } | Remove-HashtableEntry -NullOrEmptyValues Get-GitHubMyRepositories @params } 'MyRepos_Aff-Vis' { @@ -205,23 +204,20 @@ filter Get-GitHubRepository { PerPage = $PerPage Since = $Since Before = $Before - } - Remove-HashtableEntry -Hashtable $params -NullOrEmptyValues + } | Remove-HashtableEntry -NullOrEmptyValues Get-GitHubMyRepositories @params } 'ByName' { $params += @{ Owner = $Owner Repo = $Repo - } - Remove-HashtableEntry -Hashtable $params -NullOrEmptyValues + } | Remove-HashtableEntry -NullOrEmptyValues Get-GitHubRepositoryByName @params } 'ListByID' { $params += @{ Since = $SinceID - } - Remove-HashtableEntry -Hashtable $params -NullOrEmptyValues + } | Remove-HashtableEntry -NullOrEmptyValues Get-GitHubRepositoryListByID @params } 'ListByOrg' { @@ -231,8 +227,7 @@ filter Get-GitHubRepository { Sort = $Sort Direction = $Direction PerPage = $PerPage - } - Remove-HashtableEntry -Hashtable $params -NullOrEmptyValues + } | Remove-HashtableEntry -NullOrEmptyValues Get-GitHubRepositoryListByOrg @params } 'ListByUser' { @@ -242,8 +237,7 @@ filter Get-GitHubRepository { Sort = $Sort Direction = $Direction PerPage = $PerPage - } - Remove-HashtableEntry -Hashtable $params -NullOrEmptyValues + } | Remove-HashtableEntry -NullOrEmptyValues Get-GitHubRepositoryListByUser @params } } From 92cda6d57b5fa7e4ab6fc7a84eb561a19680c1a7 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sun, 15 Dec 2024 17:47:28 +0100 Subject: [PATCH 11/24] Refactor body assignment in multiple scripts to improve clarity and maintainability --- .../Utilities/PowerShell/Show-CallStack.ps1 | 46 +++++++++++++++++++ .../Assets/Set-GitHubReleaseAsset.ps1 | 3 +- .../Releases/Releases/New-GitHubRelease.ps1 | 3 +- .../Releases/New-GitHubReleaseNote.ps1 | 3 +- .../Releases/Releases/Set-GitHubRelease.ps1 | 3 +- .../Repositories/Get-GitHubRepository.ps1 | 18 +++++--- .../Get-GitHubRepositoryActivity.ps1 | 3 +- .../Get-GitHubRepositoryCodeownersError.ps1 | 3 +- .../Get-GitHubRepositoryContributor.ps1 | 3 +- .../Repositories/Get-GitHubRepositoryFork.ps1 | 3 +- .../Repositories/Move-GitHubRepository.ps1 | 3 +- .../Start-GitHubRepositoryEvent.ps1 | 3 +- .../Repositories/Update-GitHubRepository.ps1 | 3 +- .../Get-GitHubRepositoryRuleSuiteList.ps1 | 3 +- src/functions/public/Teams/New-GitHubTeam.ps1 | 3 +- .../public/Teams/Update-GitHubTeam.ps1 | 3 +- 16 files changed, 86 insertions(+), 20 deletions(-) create mode 100644 src/functions/private/Utilities/PowerShell/Show-CallStack.ps1 diff --git a/src/functions/private/Utilities/PowerShell/Show-CallStack.ps1 b/src/functions/private/Utilities/PowerShell/Show-CallStack.ps1 new file mode 100644 index 00000000..92315139 --- /dev/null +++ b/src/functions/private/Utilities/PowerShell/Show-CallStack.ps1 @@ -0,0 +1,46 @@ +function Show-CallStack { + <# + .SYNOPSIS + Create a string representation of the current call stack. + + .DESCRIPTION + This function creates a string representation of the current call stack. + You can use the SkipFirst and SkipLatest parameters to skip the first and last. + By default it will skip the first (what called the initial function, typically ), + and the last (the current function, Show-CallStack). + + .EXAMPLE + Show-CallStack + First-Function\Second-Function\Third-Function + + Shows the call stack of the last function called, Third-Function, with the first () and last (Show-CallStack) functions removed. + + .EXAMPLE + Show-CallStack -SkipFirst 0 + \First-Function\Second-Function\Third-Function + + Shows the call stack of the last function called, Third-Function, with the first function included (typically ). + + .EXAMPLE + Show-CallStack -SkipLatest 0 + First-Function\Second-Function\Third-Function\Show-CallStack + + Shows the call stack of the last function called, Third-Function, with the last function included (Show-CallStack). + #> + [CmdletBinding()] + param( + # Number of the functions to skip from the last function called. + # Last function is this function, Show-CallStack. + [Parameter()] + [int] $SkipLatest = 1, + + # Number of the functions to skip from the first function called. + # First function is typically . + [Parameter()] + [int] $SkipFirst = 1 + ) + $skipFirst++ + $cmds = (Get-PSCallStack).Command + $functionPath = $cmds[($cmds.Count - $skipFirst)..$SkipLatest] -join '\' + return $functionPath +} diff --git a/src/functions/public/Releases/Assets/Set-GitHubReleaseAsset.ps1 b/src/functions/public/Releases/Assets/Set-GitHubReleaseAsset.ps1 index 6e14adfc..f48c26b7 100644 --- a/src/functions/public/Releases/Assets/Set-GitHubReleaseAsset.ps1 +++ b/src/functions/public/Releases/Assets/Set-GitHubReleaseAsset.ps1 @@ -72,7 +72,8 @@ name = $Name label = $Label state = $State - } | Remove-HashtableEntry -NullOrEmptyValues + } + $body | Remove-HashtableEntry -NullOrEmptyValues $inputObject = @{ Context = $Context diff --git a/src/functions/public/Releases/Releases/New-GitHubRelease.ps1 b/src/functions/public/Releases/Releases/New-GitHubRelease.ps1 index e20ed6a3..060a4f60 100644 --- a/src/functions/public/Releases/Releases/New-GitHubRelease.ps1 +++ b/src/functions/public/Releases/Releases/New-GitHubRelease.ps1 @@ -112,7 +112,8 @@ generate_release_notes = $GenerateReleaseNotes draft = $Draft prerelease = $Prerelease - } | Remove-HashtableEntry -NullOrEmptyValues + } + $requestBody | Remove-HashtableEntry -NullOrEmptyValues $inputObject = @{ Context = $Context diff --git a/src/functions/public/Releases/Releases/New-GitHubReleaseNote.ps1 b/src/functions/public/Releases/Releases/New-GitHubReleaseNote.ps1 index ba9c4235..9ae5c077 100644 --- a/src/functions/public/Releases/Releases/New-GitHubReleaseNote.ps1 +++ b/src/functions/public/Releases/Releases/New-GitHubReleaseNote.ps1 @@ -121,7 +121,8 @@ target_commitish = $TargetCommitish previous_tag_name = $PreviousTagName configuration_file_path = $ConfigurationFilePath - } | Remove-HashtableEntry -NullOrEmptyValues + } + $requestBody | Remove-HashtableEntry -NullOrEmptyValues $inputObject = @{ APIEndpoint = "/repos/$Owner/$Repo/releases/generate-notes" diff --git a/src/functions/public/Releases/Releases/Set-GitHubRelease.ps1 b/src/functions/public/Releases/Releases/Set-GitHubRelease.ps1 index 41ddcd6e..cda4182b 100644 --- a/src/functions/public/Releases/Releases/Set-GitHubRelease.ps1 +++ b/src/functions/public/Releases/Releases/Set-GitHubRelease.ps1 @@ -108,7 +108,8 @@ make_latest = $MakeLatest draft = $Draft prerelease = $Prerelease - } | Remove-HashtableEntry -NullOrEmptyValues + } + $requestBody | Remove-HashtableEntry -NullOrEmptyValues $inputObject = @{ Context = $Context diff --git a/src/functions/public/Repositories/Repositories/Get-GitHubRepository.ps1 b/src/functions/public/Repositories/Repositories/Get-GitHubRepository.ps1 index 58ccf5b1..8f191450 100644 --- a/src/functions/public/Repositories/Repositories/Get-GitHubRepository.ps1 +++ b/src/functions/public/Repositories/Repositories/Get-GitHubRepository.ps1 @@ -192,7 +192,8 @@ filter Get-GitHubRepository { PerPage = $PerPage Since = $Since Before = $Before - } | Remove-HashtableEntry -NullOrEmptyValues + } + $params | Remove-HashtableEntry -NullOrEmptyValues Get-GitHubMyRepositories @params } 'MyRepos_Aff-Vis' { @@ -204,20 +205,23 @@ filter Get-GitHubRepository { PerPage = $PerPage Since = $Since Before = $Before - } | Remove-HashtableEntry -NullOrEmptyValues + } + $params | Remove-HashtableEntry -NullOrEmptyValues Get-GitHubMyRepositories @params } 'ByName' { $params += @{ Owner = $Owner Repo = $Repo - } | Remove-HashtableEntry -NullOrEmptyValues + } + $params | Remove-HashtableEntry -NullOrEmptyValues Get-GitHubRepositoryByName @params } 'ListByID' { $params += @{ Since = $SinceID - } | Remove-HashtableEntry -NullOrEmptyValues + } + $params | Remove-HashtableEntry -NullOrEmptyValues Get-GitHubRepositoryListByID @params } 'ListByOrg' { @@ -227,7 +231,8 @@ filter Get-GitHubRepository { Sort = $Sort Direction = $Direction PerPage = $PerPage - } | Remove-HashtableEntry -NullOrEmptyValues + } + $params | Remove-HashtableEntry -NullOrEmptyValues Get-GitHubRepositoryListByOrg @params } 'ListByUser' { @@ -237,7 +242,8 @@ filter Get-GitHubRepository { Sort = $Sort Direction = $Direction PerPage = $PerPage - } | Remove-HashtableEntry -NullOrEmptyValues + } + $params | Remove-HashtableEntry -NullOrEmptyValues Get-GitHubRepositoryListByUser @params } } diff --git a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryActivity.ps1 b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryActivity.ps1 index 7efe90f7..8a7553b9 100644 --- a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryActivity.ps1 +++ b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryActivity.ps1 @@ -137,7 +137,8 @@ actor = $Actor time_period = $TimePeriod activity_type = $ActivityType - } | Remove-HashtableEntry -NullOrEmptyValues + } + $body | Remove-HashtableEntry -NullOrEmptyValues $inputObject = @{ Context = $Context diff --git a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryCodeownersError.ps1 b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryCodeownersError.ps1 index d0cde188..312b4c76 100644 --- a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryCodeownersError.ps1 +++ b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryCodeownersError.ps1 @@ -62,7 +62,8 @@ try { $body = @{ ref = $Ref - } | Remove-HashtableEntry -NullOrEmptyValues + } + $body | Remove-HashtableEntry -NullOrEmptyValues $inputObject = @{ Context = $Context diff --git a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryContributor.ps1 b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryContributor.ps1 index 8d7ccf9c..810601ce 100644 --- a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryContributor.ps1 +++ b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryContributor.ps1 @@ -68,7 +68,8 @@ $body = @{ anon = $Anon per_page = $PerPage - } | Remove-HashtableEntry -NullOrEmptyValues + } + $body | Remove-HashtableEntry -NullOrEmptyValues $inputObject = @{ Context = $Context diff --git a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryFork.ps1 b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryFork.ps1 index c2ec5efc..260c7687 100644 --- a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryFork.ps1 +++ b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryFork.ps1 @@ -64,7 +64,8 @@ $body = @{ sort = $Sort per_page = $PerPage - } | Remove-HashtableEntry -NullOrEmptyValues + } + $body | Remove-HashtableEntry -NullOrEmptyValues $inputObject = @{ Context = $Context diff --git a/src/functions/public/Repositories/Repositories/Move-GitHubRepository.ps1 b/src/functions/public/Repositories/Repositories/Move-GitHubRepository.ps1 index d50c6745..f106e23f 100644 --- a/src/functions/public/Repositories/Repositories/Move-GitHubRepository.ps1 +++ b/src/functions/public/Repositories/Repositories/Move-GitHubRepository.ps1 @@ -75,7 +75,8 @@ new_owner = $NewOwner new_name = $NewName team_ids = $TeamIds - } | Remove-HashtableEntry -NullOrEmptyValues + } + $body | Remove-HashtableEntry -NullOrEmptyValues $inputObject = @{ Context = $Context diff --git a/src/functions/public/Repositories/Repositories/Start-GitHubRepositoryEvent.ps1 b/src/functions/public/Repositories/Repositories/Start-GitHubRepositoryEvent.ps1 index 59c6c929..001bf49d 100644 --- a/src/functions/public/Repositories/Repositories/Start-GitHubRepositoryEvent.ps1 +++ b/src/functions/public/Repositories/Repositories/Start-GitHubRepositoryEvent.ps1 @@ -91,7 +91,8 @@ $body = @{ event_type = $EventType client_payload = $ClientPayload - } | Remove-HashtableEntry -NullOrEmptyValues + } + $body | Remove-HashtableEntry -NullOrEmptyValues $inputObject = @{ Context = $Context diff --git a/src/functions/public/Repositories/Repositories/Update-GitHubRepository.ps1 b/src/functions/public/Repositories/Repositories/Update-GitHubRepository.ps1 index 927d64e7..f0f8c9fc 100644 --- a/src/functions/public/Repositories/Repositories/Update-GitHubRepository.ps1 +++ b/src/functions/public/Repositories/Repositories/Update-GitHubRepository.ps1 @@ -229,7 +229,8 @@ archived = $Archived ? $Archived : $null allow_forking = $AllowForking ? $AllowForking : $null web_commit_signoff_required = $WebCommitSignoffRequired ? $WebCommitSignoffRequired : $null - } | Remove-HashtableEntry -NullOrEmptyValues + } + $body | Remove-HashtableEntry -NullOrEmptyValues $inputObject = @{ Context = $Context diff --git a/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuiteList.ps1 b/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuiteList.ps1 index 85ea9e3f..069c8ab8 100644 --- a/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuiteList.ps1 +++ b/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuiteList.ps1 @@ -94,7 +94,8 @@ actor_name = $ActorName rule_suite_result = $RuleSuiteResult per_page = $PerPage - } | Remove-HashtableEntry -NullOrEmptyValues + } + $body | Remove-HashtableEntry -NullOrEmptyValues $inputObject = @{ Context = $Context diff --git a/src/functions/public/Teams/New-GitHubTeam.ps1 b/src/functions/public/Teams/New-GitHubTeam.ps1 index f55edb1b..24cb3b66 100644 --- a/src/functions/public/Teams/New-GitHubTeam.ps1 +++ b/src/functions/public/Teams/New-GitHubTeam.ps1 @@ -108,7 +108,8 @@ notification_setting = $NotificationSetting permission = $Permission parent_team_id = $ParentTeamID -eq 0 ? $null : $ParentTeamID - } | Remove-HashtableEntry -NullOrEmptyValues + } + $body | Remove-HashtableEntry -NullOrEmptyValues $inputObject = @{ Context = $Context diff --git a/src/functions/public/Teams/Update-GitHubTeam.ps1 b/src/functions/public/Teams/Update-GitHubTeam.ps1 index b5bae152..887539b5 100644 --- a/src/functions/public/Teams/Update-GitHubTeam.ps1 +++ b/src/functions/public/Teams/Update-GitHubTeam.ps1 @@ -100,7 +100,8 @@ notification_setting = $NotificationSetting permission = $Permission parent_team_id = $ParentTeamID - } | Remove-HashtableEntry -NullOrEmptyValues + } + $body | Remove-HashtableEntry -NullOrEmptyValues $inputObject = @{ Context = $Context From 306a489c8a382255cf3f637ac960ebf3dff436a1 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sun, 15 Dec 2024 18:42:12 +0100 Subject: [PATCH 12/24] Replace command name with stack path in debug messages for improved clarity across multiple scripts --- .../Actions/Get-GitHubWorkflowRunByRepo.ps1 | 6 +++--- .../Get-GitHubWorkflowRunByWorkflow.ps1 | 6 +++--- .../private/Apps/Get-GitHubAppByName.ps1 | 6 +++--- .../Apps/Get-GitHubAuthenticatedApp.ps1 | 6 +++--- .../Auth/Context/Assert-GitHubContext.ps1 | 6 +++--- .../Auth/Context/Remove-GitHubContext.ps1 | 6 +++--- .../Auth/Context/Resolve-GitHubContext.ps1 | 6 +++--- .../private/Auth/Context/Set-GitHubContext.ps1 | 6 +++--- .../Invoke-GitHubDeviceFlowLogin.ps1 | 6 +++--- .../DeviceFlow/Request-GitHubAccessToken.ps1 | 6 +++--- .../DeviceFlow/Request-GitHubDeviceCode.ps1 | 6 +++--- .../Test-GitHubAccessTokenRefreshRequired.ps1 | 6 +++--- .../Auth/DeviceFlow/Wait-GitHubAccessToken.ps1 | 6 +++--- .../Commands/ConvertFrom-GitHubOutput.ps1 | 6 +++--- .../Commands/ConvertTo-GitHubOutput.ps1 | 6 +++--- .../private/Config/Initialize-GitHubConfig.ps1 | 6 +++--- .../Gitignore/Get-GitHubGitignoreByName.ps1 | 6 +++--- .../Gitignore/Get-GitHubGitignoreList.ps1 | 6 +++--- .../License/Get-GitHubLicenseByName.ps1 | 6 +++--- .../private/License/Get-GitHubLicenseList.ps1 | 6 +++--- .../License/Get-GitHubRepositoryLicense.ps1 | 6 +++--- .../Block-GitHubUserByOrganization.ps1 | 6 +++--- .../Get-GitHubBlockedUserByOrganization.ps1 | 6 +++--- .../Test-GitHubBlockedUserByOrganization.ps1 | 6 +++--- .../Unblock-GitHubUserByOrganization.ps1 | 6 +++--- .../Organization/Get-GitHubAllOrganization.ps1 | 6 +++--- .../Organization/Get-GitHubMyOrganization.ps1 | 6 +++--- .../Get-GitHubOrganizationByName.ps1 | 6 +++--- .../Get-GitHubUserOrganization.ps1 | 6 +++--- .../Assets/Get-GitHubReleaseAssetByID.ps1 | 6 +++--- .../Get-GitHubReleaseAssetByReleaseID.ps1 | 6 +++--- .../Releases/Releases/Get-GitHubReleaseAll.ps1 | 6 +++--- .../Releases/Get-GitHubReleaseByID.ps1 | 6 +++--- .../Releases/Get-GitHubReleaseByTagName.ps1 | 6 +++--- .../Releases/Get-GitHubReleaseLatest.ps1 | 6 +++--- .../Get-GitHubRepositoryAutolinkById.ps1 | 6 +++--- .../Get-GitHubRepositoryAutolinkList.ps1 | 6 +++--- .../Fork/New-GitHubRepositoryAsFork.ps1 | 6 +++--- .../Repositories/Get-GitHubMyRepositories.ps1 | 6 +++--- .../Get-GitHubRepositoryByName.ps1 | 6 +++--- .../Get-GitHubRepositoryListByID.ps1 | 6 +++--- .../Get-GitHubRepositoryListByOrg.ps1 | 6 +++--- .../Get-GitHubRepositoryListByUser.ps1 | 6 +++--- .../New-GitHubRepositoryFromTemplate.ps1 | 6 +++--- .../Repositories/New-GitHubRepositoryOrg.ps1 | 6 +++--- .../Repositories/New-GitHubRepositoryUser.ps1 | 6 +++--- .../Users/Blocking/Block-GitHubUserByUser.ps1 | 6 +++--- .../Blocking/Get-GitHubBlockedUserByUser.ps1 | 6 +++--- .../Blocking/Test-GitHubBlockedUserByUser.ps1 | 6 +++--- .../Blocking/Unblock-GitHubUserByUser.ps1 | 6 +++--- .../Users/Emails/Get-GitHubUserAllEmail.ps1 | 6 +++--- .../Users/Emails/Get-GitHubUserPublicEmail.ps1 | 6 +++--- .../Get-GitHubUserFollowersOfUser.ps1 | 6 +++--- .../Followers/Get-GitHubUserFollowingMe.ps1 | 6 +++--- .../Followers/Get-GitHubUserFollowingUser.ps1 | 6 +++--- .../Followers/Get-GitHubUserMyFollowers.ps1 | 6 +++--- .../Followers/Test-GitHubUserFollowedByMe.ps1 | 6 +++--- .../Test-GitHubUserFollowedByUser.ps1 | 6 +++--- .../GPG-Keys/Get-GitHubUserGpgKeyForUser.ps1 | 6 +++--- .../Users/GPG-Keys/Get-GitHubUserMyGpgKey.ps1 | 6 +++--- .../GPG-Keys/Get-GitHubUserMyGpgKeyById.ps1 | 6 +++--- .../private/Users/Get-GitHubAllUser.ps1 | 6 +++--- .../private/Users/Get-GitHubMyUser.ps1 | 6 +++--- .../private/Users/Get-GitHubUserByName.ps1 | 6 +++--- .../Users/Keys/Get-GitHubUserKeyForUser.ps1 | 6 +++--- .../private/Users/Keys/Get-GitHubUserMyKey.ps1 | 6 +++--- .../Users/Keys/Get-GitHubUserMyKeyById.ps1 | 6 +++--- .../Get-GitHubUserMySigningKey.ps1 | 6 +++--- .../Get-GitHubUserMySigningKeyById.ps1 | 6 +++--- .../Get-GitHubUserSigningKeyForUser.ps1 | 6 +++--- .../Get-GitHubMyUserSocials.ps1 | 6 +++--- .../Get-GitHubUserSocialsByName.ps1 | 6 +++--- ...w-CallStack.ps1 => Get-PSCallStackPath.ps1} | 18 +++++++++--------- src/functions/public/API/Invoke-GitHubAPI.ps1 | 6 +++--- .../public/Actions/Disable-GitHubWorkflow.ps1 | 6 +++--- .../public/Actions/Enable-GitHubWorkflow.ps1 | 6 +++--- .../public/Actions/Get-GitHubWorkflow.ps1 | 6 +++--- .../public/Actions/Get-GitHubWorkflowRun.ps1 | 6 +++--- .../public/Actions/Get-GitHubWorkflowUsage.ps1 | 6 +++--- .../Actions/Remove-GitHubWorkflowRun.ps1 | 6 +++--- .../public/Actions/Start-GitHubWorkflow.ps1 | 6 +++--- .../Actions/Start-GitHubWorkflowReRun.ps1 | 6 +++--- .../public/Actions/Stop-GitHubWorkflowRun.ps1 | 6 +++--- .../public/Apps/Get-GitHubAppJSONWebToken.ps1 | 6 +++--- .../public/Apps/GitHub Apps/Get-GitHubApp.ps1 | 6 +++--- .../GitHub Apps/Get-GitHubAppInstallation.ps1 | 6 +++--- .../New-GitHubAppInstallationAccessToken.ps1 | 6 +++--- .../Get-GitHubAppWebhookConfiguration.ps1 | 6 +++--- .../Webhooks/Get-GitHubAppWebhookDelivery.ps1 | 6 +++--- .../public/Auth/Connect-GitHubAccount.ps1 | 6 +++--- .../public/Auth/Connect-GitHubApp.ps1 | 6 +++--- .../public/Auth/Context/Get-GitHubContext.ps1 | 6 +++--- .../Auth/Context/Set-GitHubDefaultContext.ps1 | 6 +++--- .../public/Auth/Disconnect-GitHubAccount.ps1 | 6 +++--- src/functions/public/Auth/Get-GitHubViewer.ps1 | 6 +++--- .../Auth/Update-GitHubUserAccessToken.ps1 | 6 +++--- .../public/Branches/Get-GitHubRepoBranch.ps1 | 6 +++--- .../public/Commands/Add-GitHubMask.ps1 | 6 +++--- .../public/Commands/Add-GitHubSystemPath.ps1 | 6 +++--- .../public/Commands/Disable-GitHubCommand.ps1 | 6 +++--- .../public/Commands/Enable-GitHubCommand.ps1 | 6 +++--- .../public/Commands/Get-GitHubOutput.ps1 | 6 +++--- .../Commands/Set-GitHubEnvironmentVariable.ps1 | 6 +++--- .../public/Commands/Set-GitHubLogGroup.ps1 | 6 +++--- .../Commands/Set-GitHubNoCommandGroup.ps1 | 6 +++--- .../public/Commands/Set-GitHubOutput.ps1 | 6 +++--- .../public/Commands/Set-GitHubStepSummary.ps1 | 6 +++--- .../public/Commands/Start-GitHubLogGroup.ps1 | 6 +++--- .../public/Commands/Stop-GitHubLogGroup.ps1 | 6 +++--- .../public/Commands/Write-GitHubDebug.ps1 | 6 +++--- .../public/Commands/Write-GitHubError.ps1 | 6 +++--- .../public/Commands/Write-GitHubNotice.ps1 | 6 +++--- .../public/Commands/Write-GitHubWarning.ps1 | 6 +++--- .../public/Config/Get-GitHubConfig.ps1 | 6 +++--- .../public/Config/Remove-GitHubConfig.ps1 | 6 +++--- .../public/Config/Reset-GitHubConfig.ps1 | 6 +++--- .../public/Config/Set-GitHubConfig.ps1 | 6 +++--- .../public/Emojis/Get-GitHubEmoji.ps1 | 6 +++--- ...GitHubEnterpriseInstallableOrganization.ps1 | 6 +++--- .../Get-GitHubEnterpriseOrganization.ps1 | 6 +++--- ...stall-GitHubAppOnEnterpriseOrganization.ps1 | 6 +++--- .../public/Git/Get-GitHubGitConfig.ps1 | 6 +++--- .../public/Git/Set-GitHubGitConfig.ps1 | 6 +++--- .../public/Gitignore/Get-GitHubGitignore.ps1 | 6 +++--- .../GraphQL/Invoke-GitHubGraphQLQuery.ps1 | 6 +++--- .../public/License/Get-GitHubLicense.ps1 | 6 +++--- .../public/Markdown/Get-GitHubMarkdown.ps1 | 6 +++--- .../public/Markdown/Get-GitHubMarkdownRaw.ps1 | 6 +++--- .../public/Meta/Get-GitHubApiVersion.ps1 | 6 +++--- src/functions/public/Meta/Get-GitHubMeta.ps1 | 6 +++--- .../public/Meta/Get-GitHubOctocat.ps1 | 6 +++--- src/functions/public/Meta/Get-GitHubRoot.ps1 | 6 +++--- src/functions/public/Meta/Get-GitHubZen.ps1 | 6 +++--- .../Organization/Get-GitHubOrganization.ps1 | 6 +++--- .../Get-GitHubOrganizationAppInstallation.ps1 | 6 +++--- .../Members/Get-GitHubOrganizationMember.ps1 | 6 +++--- ...Get-GitHubOrganizationPendingInvitation.ps1 | 6 +++--- .../New-GitHubOrganizationInvitation.ps1 | 6 +++--- .../Organization/Remove-GitHubOrganization.ps1 | 6 +++--- .../Organization/Set-GitHubOrganization.ps1 | 6 +++--- .../Set-GitHubOrganizationSecurityFeature.ps1 | 6 +++--- .../public/Rate-Limit/Get-GitHubRateLimit.ps1 | 6 +++--- .../Releases/Assets/Add-GitHubReleaseAsset.ps1 | 6 +++--- .../Releases/Assets/Get-GitHubReleaseAsset.ps1 | 6 +++--- .../Assets/Remove-GitHubReleaseAsset.ps1 | 6 +++--- .../Releases/Assets/Set-GitHubReleaseAsset.ps1 | 6 +++--- .../Releases/Releases/Get-GitHubRelease.ps1 | 6 +++--- .../Releases/Releases/New-GitHubRelease.ps1 | 6 +++--- .../Releases/New-GitHubReleaseNote.ps1 | 6 +++--- .../Releases/Releases/Remove-GitHubRelease.ps1 | 6 +++--- .../Releases/Releases/Set-GitHubRelease.ps1 | 6 +++--- .../Autolinks/Get-GitHubRepositoryAutolink.ps1 | 6 +++--- .../Autolinks/New-GitHubRepositoryAutolink.ps1 | 6 +++--- .../Remove-GitHubRepositoryAutolink.ps1 | 6 +++--- .../Get-GitHubRepositoryCustomProperty.ps1 | 6 +++--- ...RepositoryPrivateVulnerabilityReporting.ps1 | 6 +++--- .../Disable-GitHubRepositorySecurityFix.ps1 | 6 +++--- ...able-GitHubRepositoryVulnerabilityAlert.ps1 | 6 +++--- ...RepositoryPrivateVulnerabilityReporting.ps1 | 6 +++--- .../Enable-GitHubRepositorySecurityFix.ps1 | 6 +++--- ...able-GitHubRepositoryVulnerabilityAlert.ps1 | 6 +++--- .../Repositories/Get-GitHubRepository.ps1 | 12 +++--------- .../Get-GitHubRepositoryActivity.ps1 | 6 +++--- .../Get-GitHubRepositoryCodeownersError.ps1 | 6 +++--- .../Get-GitHubRepositoryContributor.ps1 | 6 +++--- .../Repositories/Get-GitHubRepositoryFork.ps1 | 6 +++--- .../Get-GitHubRepositoryLanguage.ps1 | 6 +++--- .../Get-GitHubRepositorySecurityFix.ps1 | 6 +++--- .../Repositories/Get-GitHubRepositoryTag.ps1 | 6 +++--- .../Repositories/Get-GitHubRepositoryTeam.ps1 | 6 +++--- .../Repositories/Get-GitHubRepositoryTopic.ps1 | 6 +++--- .../Repositories/Move-GitHubRepository.ps1 | 6 +++--- .../Repositories/New-GitHubRepository.ps1 | 6 +++--- .../Repositories/Remove-GitHubRepository.ps1 | 6 +++--- .../Repositories/Set-GitHubRepositoryTopic.ps1 | 6 +++--- .../Start-GitHubRepositoryEvent.ps1 | 6 +++--- ...Test-GitHubRepositoryVulnerabilityAlert.ps1 | 6 +++--- .../Repositories/Update-GitHubRepository.ps1 | 6 +++--- .../Get-GitHubRepositoryRuleSuite.ps1 | 6 +++--- .../Get-GitHubRepositoryRuleSuiteById.ps1 | 6 +++--- .../Get-GitHubRepositoryRuleSuiteList.ps1 | 6 +++--- .../Tags/Get-GitHubRepositoryTagProtection.ps1 | 6 +++--- .../Tags/New-GitHubRepositoryTagProtection.ps1 | 6 +++--- .../Remove-GitHubRepositoryTagProtection.ps1 | 6 +++--- .../Status/Get-GitHubScheduledMaintenance.ps1 | 6 +++--- .../public/Status/Get-GitHubStatus.ps1 | 6 +++--- .../Status/Get-GitHubStatusComponent.ps1 | 6 +++--- .../public/Status/Get-GitHubStatusIncident.ps1 | 6 +++--- .../public/Teams/Get-GitHubRepoTeam.ps1 | 6 +++--- .../public/Teams/Get-GitHubTeamByName.ps1 | 6 +++--- .../public/Teams/Get-GitHubTeamListByOrg.ps1 | 6 +++--- src/functions/public/Teams/New-GitHubTeam.ps1 | 6 +++--- .../public/Teams/Remove-GitHubTeam.ps1 | 6 +++--- .../public/Teams/Update-GitHubTeam.ps1 | 6 +++--- .../public/Users/Blocking/Block-GitHubUser.ps1 | 6 +++--- .../Users/Blocking/Get-GitHubBlockedUser.ps1 | 6 +++--- .../Users/Blocking/Test-GitHubBlockedUser.ps1 | 6 +++--- .../Users/Blocking/Unblock-GitHubUser.ps1 | 6 +++--- .../Users/Emails/Add-GitHubUserEmail.ps1 | 6 +++--- .../Users/Emails/Get-GitHubUserEmail.ps1 | 6 +++--- .../Users/Emails/Remove-GitHubUserEmail.ps1 | 6 +++--- .../Emails/Set-GitHubUserEmailVisibility.ps1 | 6 +++--- .../Followers/Add-GitHubUserFollowing.ps1 | 6 +++--- .../Users/Followers/Get-GitHubUserFollower.ps1 | 6 +++--- .../Followers/Get-GitHubUserFollowing.ps1 | 6 +++--- .../Followers/Remove-GitHubUserFollowing.ps1 | 6 +++--- .../Followers/Test-GitHubUserFollowing.ps1 | 6 +++--- .../Users/GPG-Keys/Add-GitHubUserGpgKey.ps1 | 6 +++--- .../Users/GPG-Keys/Get-GitHubUserGpgKey.ps1 | 6 +++--- .../Users/GPG-Keys/Remove-GitHubUserGpgKey.ps1 | 6 +++--- src/functions/public/Users/Get-GitHubUser.ps1 | 6 +++--- .../public/Users/Get-GitHubUserCard.ps1 | 6 +++--- .../public/Users/Keys/Add-GitHubUserKey.ps1 | 6 +++--- .../public/Users/Keys/Get-GitHubUserKey.ps1 | 6 +++--- .../public/Users/Keys/Remove-GitHubUserKey.ps1 | 6 +++--- .../Add-GitHubUserSigningKey.ps1 | 6 +++--- .../Get-GitHubUserSigningKey.ps1 | 6 +++--- .../Remove-GitHubUserSigningKey.ps1 | 6 +++--- src/functions/public/Users/Set-GitHubUser.ps1 | 6 +++--- .../Social-Accounts/Add-GitHubUserSocial.ps1 | 6 +++--- .../Remove-GitHubUserSocial.ps1 | 6 +++--- 221 files changed, 669 insertions(+), 675 deletions(-) rename src/functions/private/Utilities/PowerShell/{Show-CallStack.ps1 => Get-PSCallStackPath.ps1} (72%) diff --git a/src/functions/private/Actions/Get-GitHubWorkflowRunByRepo.ps1 b/src/functions/private/Actions/Get-GitHubWorkflowRunByRepo.ps1 index ec6b9548..87944eaa 100644 --- a/src/functions/private/Actions/Get-GitHubWorkflowRunByRepo.ps1 +++ b/src/functions/private/Actions/Get-GitHubWorkflowRunByRepo.ps1 @@ -88,8 +88,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT if ([string]::IsNullOrEmpty($Owner)) { @@ -133,6 +133,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Actions/Get-GitHubWorkflowRunByWorkflow.ps1 b/src/functions/private/Actions/Get-GitHubWorkflowRunByWorkflow.ps1 index 93b8e723..8e230df0 100644 --- a/src/functions/private/Actions/Get-GitHubWorkflowRunByWorkflow.ps1 +++ b/src/functions/private/Actions/Get-GitHubWorkflowRunByWorkflow.ps1 @@ -95,8 +95,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT if ([string]::IsNullOrEmpty($Owner)) { @@ -140,6 +140,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Apps/Get-GitHubAppByName.ps1 b/src/functions/private/Apps/Get-GitHubAppByName.ps1 index e0c461cd..df1b98df 100644 --- a/src/functions/private/Apps/Get-GitHubAppByName.ps1 +++ b/src/functions/private/Apps/Get-GitHubAppByName.ps1 @@ -31,8 +31,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -53,6 +53,6 @@ } } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Apps/Get-GitHubAuthenticatedApp.ps1 b/src/functions/private/Apps/Get-GitHubAuthenticatedApp.ps1 index f14ced4a..c32b49a4 100644 --- a/src/functions/private/Apps/Get-GitHubAuthenticatedApp.ps1 +++ b/src/functions/private/Apps/Get-GitHubAuthenticatedApp.ps1 @@ -30,8 +30,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType App } @@ -54,6 +54,6 @@ } } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Auth/Context/Assert-GitHubContext.ps1 b/src/functions/private/Auth/Context/Assert-GitHubContext.ps1 index e101876b..d5484454 100644 --- a/src/functions/private/Auth/Context/Assert-GitHubContext.ps1 +++ b/src/functions/private/Auth/Context/Assert-GitHubContext.ps1 @@ -26,8 +26,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" } process { @@ -39,6 +39,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Auth/Context/Remove-GitHubContext.ps1 b/src/functions/private/Auth/Context/Remove-GitHubContext.ps1 index 653633f8..74aaaae3 100644 --- a/src/functions/private/Auth/Context/Remove-GitHubContext.ps1 +++ b/src/functions/private/Auth/Context/Remove-GitHubContext.ps1 @@ -30,8 +30,8 @@ filter Remove-GitHubContext { ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $null = Get-GitHubConfig } @@ -44,6 +44,6 @@ filter Remove-GitHubContext { } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Auth/Context/Resolve-GitHubContext.ps1 b/src/functions/private/Auth/Context/Resolve-GitHubContext.ps1 index 7bdf2fba..dffd3960 100644 --- a/src/functions/private/Auth/Context/Resolve-GitHubContext.ps1 +++ b/src/functions/private/Auth/Context/Resolve-GitHubContext.ps1 @@ -30,8 +30,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" Initialize-GitHubConfig } @@ -65,7 +65,7 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" Write-Output $Context } } diff --git a/src/functions/private/Auth/Context/Set-GitHubContext.ps1 b/src/functions/private/Auth/Context/Set-GitHubContext.ps1 index e80fa14e..716ca18e 100644 --- a/src/functions/private/Auth/Context/Set-GitHubContext.ps1 +++ b/src/functions/private/Auth/Context/Set-GitHubContext.ps1 @@ -39,8 +39,8 @@ function Set-GitHubContext { ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $null = Get-GitHubConfig $contextObj = @{} + $Context } @@ -164,6 +164,6 @@ function Set-GitHubContext { } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Auth/DeviceFlow/Invoke-GitHubDeviceFlowLogin.ps1 b/src/functions/private/Auth/DeviceFlow/Invoke-GitHubDeviceFlowLogin.ps1 index c2ea74ae..abce7271 100644 --- a/src/functions/private/Auth/DeviceFlow/Invoke-GitHubDeviceFlowLogin.ps1 +++ b/src/functions/private/Auth/DeviceFlow/Invoke-GitHubDeviceFlowLogin.ps1 @@ -42,8 +42,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" } process { @@ -75,6 +75,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Auth/DeviceFlow/Request-GitHubAccessToken.ps1 b/src/functions/private/Auth/DeviceFlow/Request-GitHubAccessToken.ps1 index 289f7de7..5592d1e7 100644 --- a/src/functions/private/Auth/DeviceFlow/Request-GitHubAccessToken.ps1 +++ b/src/functions/private/Auth/DeviceFlow/Request-GitHubAccessToken.ps1 @@ -43,8 +43,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" } process { @@ -87,6 +87,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Auth/DeviceFlow/Request-GitHubDeviceCode.ps1 b/src/functions/private/Auth/DeviceFlow/Request-GitHubDeviceCode.ps1 index 117297cf..8a0b2266 100644 --- a/src/functions/private/Auth/DeviceFlow/Request-GitHubDeviceCode.ps1 +++ b/src/functions/private/Auth/DeviceFlow/Request-GitHubDeviceCode.ps1 @@ -35,8 +35,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" } process { @@ -68,6 +68,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Auth/DeviceFlow/Test-GitHubAccessTokenRefreshRequired.ps1 b/src/functions/private/Auth/DeviceFlow/Test-GitHubAccessTokenRefreshRequired.ps1 index e2d04b00..a4e6f305 100644 --- a/src/functions/private/Auth/DeviceFlow/Test-GitHubAccessTokenRefreshRequired.ps1 +++ b/src/functions/private/Auth/DeviceFlow/Test-GitHubAccessTokenRefreshRequired.ps1 @@ -21,8 +21,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context } @@ -38,6 +38,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Auth/DeviceFlow/Wait-GitHubAccessToken.ps1 b/src/functions/private/Auth/DeviceFlow/Wait-GitHubAccessToken.ps1 index a02490a3..d5742619 100644 --- a/src/functions/private/Auth/DeviceFlow/Wait-GitHubAccessToken.ps1 +++ b/src/functions/private/Auth/DeviceFlow/Wait-GitHubAccessToken.ps1 @@ -50,8 +50,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" } process { @@ -126,6 +126,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Commands/ConvertFrom-GitHubOutput.ps1 b/src/functions/private/Commands/ConvertFrom-GitHubOutput.ps1 index 4d0c00ec..03eec227 100644 --- a/src/functions/private/Commands/ConvertFrom-GitHubOutput.ps1 +++ b/src/functions/private/Commands/ConvertFrom-GitHubOutput.ps1 @@ -49,8 +49,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $lines = @() } @@ -134,6 +134,6 @@ } else { [PSCustomObject]$result } - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Commands/ConvertTo-GitHubOutput.ps1 b/src/functions/private/Commands/ConvertTo-GitHubOutput.ps1 index a2016556..1562b1dc 100644 --- a/src/functions/private/Commands/ConvertTo-GitHubOutput.ps1 +++ b/src/functions/private/Commands/ConvertTo-GitHubOutput.ps1 @@ -47,8 +47,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" } process { @@ -87,6 +87,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Config/Initialize-GitHubConfig.ps1 b/src/functions/private/Config/Initialize-GitHubConfig.ps1 index e99769f9..84aaab67 100644 --- a/src/functions/private/Config/Initialize-GitHubConfig.ps1 +++ b/src/functions/private/Config/Initialize-GitHubConfig.ps1 @@ -24,8 +24,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" } process { @@ -51,6 +51,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Gitignore/Get-GitHubGitignoreByName.ps1 b/src/functions/private/Gitignore/Get-GitHubGitignoreByName.ps1 index f5371d92..e3c0fbc1 100644 --- a/src/functions/private/Gitignore/Get-GitHubGitignoreByName.ps1 +++ b/src/functions/private/Gitignore/Get-GitHubGitignoreByName.ps1 @@ -28,8 +28,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -52,6 +52,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Gitignore/Get-GitHubGitignoreList.ps1 b/src/functions/private/Gitignore/Get-GitHubGitignoreList.ps1 index 9dc4690f..7d1c7094 100644 --- a/src/functions/private/Gitignore/Get-GitHubGitignoreList.ps1 +++ b/src/functions/private/Gitignore/Get-GitHubGitignoreList.ps1 @@ -26,8 +26,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -49,6 +49,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/License/Get-GitHubLicenseByName.ps1 b/src/functions/private/License/Get-GitHubLicenseByName.ps1 index 847534ad..a058020c 100644 --- a/src/functions/private/License/Get-GitHubLicenseByName.ps1 +++ b/src/functions/private/License/Get-GitHubLicenseByName.ps1 @@ -31,8 +31,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -55,6 +55,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/License/Get-GitHubLicenseList.ps1 b/src/functions/private/License/Get-GitHubLicenseList.ps1 index d351783a..42506ae1 100644 --- a/src/functions/private/License/Get-GitHubLicenseList.ps1 +++ b/src/functions/private/License/Get-GitHubLicenseList.ps1 @@ -26,8 +26,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -49,6 +49,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/License/Get-GitHubRepositoryLicense.ps1 b/src/functions/private/License/Get-GitHubRepositoryLicense.ps1 index 7883c464..d2363b01 100644 --- a/src/functions/private/License/Get-GitHubRepositoryLicense.ps1 +++ b/src/functions/private/License/Get-GitHubRepositoryLicense.ps1 @@ -35,8 +35,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT @@ -71,6 +71,6 @@ } } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Organization/Blocking/Block-GitHubUserByOrganization.ps1 b/src/functions/private/Organization/Blocking/Block-GitHubUserByOrganization.ps1 index 9fc809f1..109173ff 100644 --- a/src/functions/private/Organization/Blocking/Block-GitHubUserByOrganization.ps1 +++ b/src/functions/private/Organization/Blocking/Block-GitHubUserByOrganization.ps1 @@ -45,8 +45,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -73,7 +73,7 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Organization/Blocking/Get-GitHubBlockedUserByOrganization.ps1 b/src/functions/private/Organization/Blocking/Get-GitHubBlockedUserByOrganization.ps1 index 5d21ed3c..d99be05e 100644 --- a/src/functions/private/Organization/Blocking/Get-GitHubBlockedUserByOrganization.ps1 +++ b/src/functions/private/Organization/Blocking/Get-GitHubBlockedUserByOrganization.ps1 @@ -36,8 +36,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -63,6 +63,6 @@ } } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Organization/Blocking/Test-GitHubBlockedUserByOrganization.ps1 b/src/functions/private/Organization/Blocking/Test-GitHubBlockedUserByOrganization.ps1 index a13f8777..928be843 100644 --- a/src/functions/private/Organization/Blocking/Test-GitHubBlockedUserByOrganization.ps1 +++ b/src/functions/private/Organization/Blocking/Test-GitHubBlockedUserByOrganization.ps1 @@ -44,8 +44,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -69,7 +69,7 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Organization/Blocking/Unblock-GitHubUserByOrganization.ps1 b/src/functions/private/Organization/Blocking/Unblock-GitHubUserByOrganization.ps1 index 95b20730..97836029 100644 --- a/src/functions/private/Organization/Blocking/Unblock-GitHubUserByOrganization.ps1 +++ b/src/functions/private/Organization/Blocking/Unblock-GitHubUserByOrganization.ps1 @@ -45,8 +45,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -68,6 +68,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Organization/Get-GitHubAllOrganization.ps1 b/src/functions/private/Organization/Get-GitHubAllOrganization.ps1 index d42d8f5b..d8a1102d 100644 --- a/src/functions/private/Organization/Get-GitHubAllOrganization.ps1 +++ b/src/functions/private/Organization/Get-GitHubAllOrganization.ps1 @@ -38,8 +38,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -66,6 +66,6 @@ } } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Organization/Get-GitHubMyOrganization.ps1 b/src/functions/private/Organization/Get-GitHubMyOrganization.ps1 index 4290e6cc..b561dcb6 100644 --- a/src/functions/private/Organization/Get-GitHubMyOrganization.ps1 +++ b/src/functions/private/Organization/Get-GitHubMyOrganization.ps1 @@ -37,8 +37,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -65,6 +65,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Organization/Get-GitHubOrganizationByName.ps1 b/src/functions/private/Organization/Get-GitHubOrganizationByName.ps1 index 424cb923..bceada5a 100644 --- a/src/functions/private/Organization/Get-GitHubOrganizationByName.ps1 +++ b/src/functions/private/Organization/Get-GitHubOrganizationByName.ps1 @@ -43,8 +43,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -65,6 +65,6 @@ } } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Organization/Get-GitHubUserOrganization.ps1 b/src/functions/private/Organization/Get-GitHubUserOrganization.ps1 index e4bdc5c6..e66124df 100644 --- a/src/functions/private/Organization/Get-GitHubUserOrganization.ps1 +++ b/src/functions/private/Organization/Get-GitHubUserOrganization.ps1 @@ -39,8 +39,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -66,6 +66,6 @@ } } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Releases/Assets/Get-GitHubReleaseAssetByID.ps1 b/src/functions/private/Releases/Assets/Get-GitHubReleaseAssetByID.ps1 index 07ae996f..5bcd7b49 100644 --- a/src/functions/private/Releases/Assets/Get-GitHubReleaseAssetByID.ps1 +++ b/src/functions/private/Releases/Assets/Get-GitHubReleaseAssetByID.ps1 @@ -40,8 +40,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT if ([string]::IsNullOrEmpty($Owner)) { @@ -73,6 +73,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Releases/Assets/Get-GitHubReleaseAssetByReleaseID.ps1 b/src/functions/private/Releases/Assets/Get-GitHubReleaseAssetByReleaseID.ps1 index 782f71f7..2b949bd9 100644 --- a/src/functions/private/Releases/Assets/Get-GitHubReleaseAssetByReleaseID.ps1 +++ b/src/functions/private/Releases/Assets/Get-GitHubReleaseAssetByReleaseID.ps1 @@ -45,8 +45,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT if ([string]::IsNullOrEmpty($Owner)) { @@ -81,6 +81,6 @@ } } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Releases/Releases/Get-GitHubReleaseAll.ps1 b/src/functions/private/Releases/Releases/Get-GitHubReleaseAll.ps1 index f90945c1..c66121d3 100644 --- a/src/functions/private/Releases/Releases/Get-GitHubReleaseAll.ps1 +++ b/src/functions/private/Releases/Releases/Get-GitHubReleaseAll.ps1 @@ -39,8 +39,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT if ([string]::IsNullOrEmpty($Owner)) { @@ -75,6 +75,6 @@ } } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Releases/Releases/Get-GitHubReleaseByID.ps1 b/src/functions/private/Releases/Releases/Get-GitHubReleaseByID.ps1 index 73ff06d8..536b3d68 100644 --- a/src/functions/private/Releases/Releases/Get-GitHubReleaseByID.ps1 +++ b/src/functions/private/Releases/Releases/Get-GitHubReleaseByID.ps1 @@ -38,8 +38,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT if ([string]::IsNullOrEmpty($Owner)) { @@ -70,6 +70,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Releases/Releases/Get-GitHubReleaseByTagName.ps1 b/src/functions/private/Releases/Releases/Get-GitHubReleaseByTagName.ps1 index 4ba2856a..572f2f55 100644 --- a/src/functions/private/Releases/Releases/Get-GitHubReleaseByTagName.ps1 +++ b/src/functions/private/Releases/Releases/Get-GitHubReleaseByTagName.ps1 @@ -37,8 +37,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT if ([string]::IsNullOrEmpty($Owner)) { @@ -69,6 +69,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Releases/Releases/Get-GitHubReleaseLatest.ps1 b/src/functions/private/Releases/Releases/Get-GitHubReleaseLatest.ps1 index 631912de..03f0d931 100644 --- a/src/functions/private/Releases/Releases/Get-GitHubReleaseLatest.ps1 +++ b/src/functions/private/Releases/Releases/Get-GitHubReleaseLatest.ps1 @@ -34,8 +34,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT if ([string]::IsNullOrEmpty($Owner)) { @@ -66,6 +66,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Repositories/Autolinks/Get-GitHubRepositoryAutolinkById.ps1 b/src/functions/private/Repositories/Autolinks/Get-GitHubRepositoryAutolinkById.ps1 index 58bbabf5..1b9e2614 100644 --- a/src/functions/private/Repositories/Autolinks/Get-GitHubRepositoryAutolinkById.ps1 +++ b/src/functions/private/Repositories/Autolinks/Get-GitHubRepositoryAutolinkById.ps1 @@ -41,8 +41,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT if ([string]::IsNullOrEmpty($Owner)) { @@ -73,6 +73,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Repositories/Autolinks/Get-GitHubRepositoryAutolinkList.ps1 b/src/functions/private/Repositories/Autolinks/Get-GitHubRepositoryAutolinkList.ps1 index 97d45991..89dacc33 100644 --- a/src/functions/private/Repositories/Autolinks/Get-GitHubRepositoryAutolinkList.ps1 +++ b/src/functions/private/Repositories/Autolinks/Get-GitHubRepositoryAutolinkList.ps1 @@ -35,8 +35,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT if ([string]::IsNullOrEmpty($Owner)) { @@ -67,6 +67,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Repositories/Fork/New-GitHubRepositoryAsFork.ps1 b/src/functions/private/Repositories/Fork/New-GitHubRepositoryAsFork.ps1 index 999b4155..e544d7fc 100644 --- a/src/functions/private/Repositories/Fork/New-GitHubRepositoryAsFork.ps1 +++ b/src/functions/private/Repositories/Fork/New-GitHubRepositoryAsFork.ps1 @@ -69,8 +69,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT if ([string]::IsNullOrEmpty($Owner)) { @@ -115,6 +115,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Repositories/Repositories/Get-GitHubMyRepositories.ps1 b/src/functions/private/Repositories/Repositories/Get-GitHubMyRepositories.ps1 index 5b31eab4..da8719bc 100644 --- a/src/functions/private/Repositories/Repositories/Get-GitHubMyRepositories.ps1 +++ b/src/functions/private/Repositories/Repositories/Get-GitHubMyRepositories.ps1 @@ -114,8 +114,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -155,6 +155,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Repositories/Repositories/Get-GitHubRepositoryByName.ps1 b/src/functions/private/Repositories/Repositories/Get-GitHubRepositoryByName.ps1 index ec2fdaf8..c8b7fdaf 100644 --- a/src/functions/private/Repositories/Repositories/Get-GitHubRepositoryByName.ps1 +++ b/src/functions/private/Repositories/Repositories/Get-GitHubRepositoryByName.ps1 @@ -37,8 +37,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT if ([string]::IsNullOrEmpty($Owner)) { @@ -70,6 +70,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Repositories/Repositories/Get-GitHubRepositoryListByID.ps1 b/src/functions/private/Repositories/Repositories/Get-GitHubRepositoryListByID.ps1 index 9de7f033..f3cd5268 100644 --- a/src/functions/private/Repositories/Repositories/Get-GitHubRepositoryListByID.ps1 +++ b/src/functions/private/Repositories/Repositories/Get-GitHubRepositoryListByID.ps1 @@ -34,8 +34,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -62,6 +62,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Repositories/Repositories/Get-GitHubRepositoryListByOrg.ps1 b/src/functions/private/Repositories/Repositories/Get-GitHubRepositoryListByOrg.ps1 index abdb2f8e..b77f4e68 100644 --- a/src/functions/private/Repositories/Repositories/Get-GitHubRepositoryListByOrg.ps1 +++ b/src/functions/private/Repositories/Repositories/Get-GitHubRepositoryListByOrg.ps1 @@ -63,8 +63,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT if ([string]::IsNullOrEmpty($Owner)) { @@ -98,6 +98,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Repositories/Repositories/Get-GitHubRepositoryListByUser.ps1 b/src/functions/private/Repositories/Repositories/Get-GitHubRepositoryListByUser.ps1 index c03a934a..23ca4664 100644 --- a/src/functions/private/Repositories/Repositories/Get-GitHubRepositoryListByUser.ps1 +++ b/src/functions/private/Repositories/Repositories/Get-GitHubRepositoryListByUser.ps1 @@ -65,8 +65,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT if ([string]::IsNullOrEmpty($Owner)) { @@ -105,6 +105,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Repositories/Repositories/New-GitHubRepositoryFromTemplate.ps1 b/src/functions/private/Repositories/Repositories/New-GitHubRepositoryFromTemplate.ps1 index 133ee341..9b212da4 100644 --- a/src/functions/private/Repositories/Repositories/New-GitHubRepositoryFromTemplate.ps1 +++ b/src/functions/private/Repositories/Repositories/New-GitHubRepositoryFromTemplate.ps1 @@ -79,8 +79,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT if ([string]::IsNullOrEmpty($Owner)) { @@ -117,6 +117,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Repositories/Repositories/New-GitHubRepositoryOrg.ps1 b/src/functions/private/Repositories/Repositories/New-GitHubRepositoryOrg.ps1 index 4990d1c4..4e4e0730 100644 --- a/src/functions/private/Repositories/Repositories/New-GitHubRepositoryOrg.ps1 +++ b/src/functions/private/Repositories/Repositories/New-GitHubRepositoryOrg.ps1 @@ -212,8 +212,8 @@ filter New-GitHubRepositoryOrg { } begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT $GitignoreTemplate = $PSBoundParameters['GitignoreTemplate'] @@ -268,6 +268,6 @@ filter New-GitHubRepositoryOrg { } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Repositories/Repositories/New-GitHubRepositoryUser.ps1 b/src/functions/private/Repositories/Repositories/New-GitHubRepositoryUser.ps1 index 1954e21a..3405128a 100644 --- a/src/functions/private/Repositories/Repositories/New-GitHubRepositoryUser.ps1 +++ b/src/functions/private/Repositories/Repositories/New-GitHubRepositoryUser.ps1 @@ -206,8 +206,8 @@ filter New-GitHubRepositoryUser { } begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT $GitignoreTemplate = $PSBoundParameters['GitignoreTemplate'] @@ -258,6 +258,6 @@ filter New-GitHubRepositoryUser { } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Users/Blocking/Block-GitHubUserByUser.ps1 b/src/functions/private/Users/Blocking/Block-GitHubUserByUser.ps1 index 3c75e766..4f5846da 100644 --- a/src/functions/private/Users/Blocking/Block-GitHubUserByUser.ps1 +++ b/src/functions/private/Users/Blocking/Block-GitHubUserByUser.ps1 @@ -34,8 +34,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -62,6 +62,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Users/Blocking/Get-GitHubBlockedUserByUser.ps1 b/src/functions/private/Users/Blocking/Get-GitHubBlockedUserByUser.ps1 index 5516d13a..76861487 100644 --- a/src/functions/private/Users/Blocking/Get-GitHubBlockedUserByUser.ps1 +++ b/src/functions/private/Users/Blocking/Get-GitHubBlockedUserByUser.ps1 @@ -29,8 +29,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -57,6 +57,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Users/Blocking/Test-GitHubBlockedUserByUser.ps1 b/src/functions/private/Users/Blocking/Test-GitHubBlockedUserByUser.ps1 index c5cdaf37..ebd64b1f 100644 --- a/src/functions/private/Users/Blocking/Test-GitHubBlockedUserByUser.ps1 +++ b/src/functions/private/Users/Blocking/Test-GitHubBlockedUserByUser.ps1 @@ -41,8 +41,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -75,6 +75,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Users/Blocking/Unblock-GitHubUserByUser.ps1 b/src/functions/private/Users/Blocking/Unblock-GitHubUserByUser.ps1 index 169a3495..ef2916a5 100644 --- a/src/functions/private/Users/Blocking/Unblock-GitHubUserByUser.ps1 +++ b/src/functions/private/Users/Blocking/Unblock-GitHubUserByUser.ps1 @@ -34,8 +34,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -61,6 +61,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Users/Emails/Get-GitHubUserAllEmail.ps1 b/src/functions/private/Users/Emails/Get-GitHubUserAllEmail.ps1 index b4457472..9929a4dc 100644 --- a/src/functions/private/Users/Emails/Get-GitHubUserAllEmail.ps1 +++ b/src/functions/private/Users/Emails/Get-GitHubUserAllEmail.ps1 @@ -31,8 +31,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -58,6 +58,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Users/Emails/Get-GitHubUserPublicEmail.ps1 b/src/functions/private/Users/Emails/Get-GitHubUserPublicEmail.ps1 index f5f282ff..d810b061 100644 --- a/src/functions/private/Users/Emails/Get-GitHubUserPublicEmail.ps1 +++ b/src/functions/private/Users/Emails/Get-GitHubUserPublicEmail.ps1 @@ -33,8 +33,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -61,6 +61,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Users/Followers/Get-GitHubUserFollowersOfUser.ps1 b/src/functions/private/Users/Followers/Get-GitHubUserFollowersOfUser.ps1 index 305c9aab..5651515d 100644 --- a/src/functions/private/Users/Followers/Get-GitHubUserFollowersOfUser.ps1 +++ b/src/functions/private/Users/Followers/Get-GitHubUserFollowersOfUser.ps1 @@ -39,8 +39,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -67,6 +67,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Users/Followers/Get-GitHubUserFollowingMe.ps1 b/src/functions/private/Users/Followers/Get-GitHubUserFollowingMe.ps1 index 362c1386..7de86587 100644 --- a/src/functions/private/Users/Followers/Get-GitHubUserFollowingMe.ps1 +++ b/src/functions/private/Users/Followers/Get-GitHubUserFollowingMe.ps1 @@ -30,8 +30,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -58,6 +58,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Users/Followers/Get-GitHubUserFollowingUser.ps1 b/src/functions/private/Users/Followers/Get-GitHubUserFollowingUser.ps1 index 91aa7815..90f9ded8 100644 --- a/src/functions/private/Users/Followers/Get-GitHubUserFollowingUser.ps1 +++ b/src/functions/private/Users/Followers/Get-GitHubUserFollowingUser.ps1 @@ -39,8 +39,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -67,6 +67,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Users/Followers/Get-GitHubUserMyFollowers.ps1 b/src/functions/private/Users/Followers/Get-GitHubUserMyFollowers.ps1 index 8245c08d..1d9af601 100644 --- a/src/functions/private/Users/Followers/Get-GitHubUserMyFollowers.ps1 +++ b/src/functions/private/Users/Followers/Get-GitHubUserMyFollowers.ps1 @@ -31,8 +31,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -59,6 +59,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Users/Followers/Test-GitHubUserFollowedByMe.ps1 b/src/functions/private/Users/Followers/Test-GitHubUserFollowedByMe.ps1 index 3a9a48a1..483e7d52 100644 --- a/src/functions/private/Users/Followers/Test-GitHubUserFollowedByMe.ps1 +++ b/src/functions/private/Users/Followers/Test-GitHubUserFollowedByMe.ps1 @@ -33,8 +33,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -59,6 +59,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Users/Followers/Test-GitHubUserFollowedByUser.ps1 b/src/functions/private/Users/Followers/Test-GitHubUserFollowedByUser.ps1 index 81a84a88..e816d018 100644 --- a/src/functions/private/Users/Followers/Test-GitHubUserFollowedByUser.ps1 +++ b/src/functions/private/Users/Followers/Test-GitHubUserFollowedByUser.ps1 @@ -39,8 +39,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -65,6 +65,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Users/GPG-Keys/Get-GitHubUserGpgKeyForUser.ps1 b/src/functions/private/Users/GPG-Keys/Get-GitHubUserGpgKeyForUser.ps1 index 9dba33c4..2d21817b 100644 --- a/src/functions/private/Users/GPG-Keys/Get-GitHubUserGpgKeyForUser.ps1 +++ b/src/functions/private/Users/GPG-Keys/Get-GitHubUserGpgKeyForUser.ps1 @@ -37,8 +37,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -65,6 +65,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Users/GPG-Keys/Get-GitHubUserMyGpgKey.ps1 b/src/functions/private/Users/GPG-Keys/Get-GitHubUserMyGpgKey.ps1 index 6f119bb6..dfdc6d03 100644 --- a/src/functions/private/Users/GPG-Keys/Get-GitHubUserMyGpgKey.ps1 +++ b/src/functions/private/Users/GPG-Keys/Get-GitHubUserMyGpgKey.ps1 @@ -32,8 +32,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -60,6 +60,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Users/GPG-Keys/Get-GitHubUserMyGpgKeyById.ps1 b/src/functions/private/Users/GPG-Keys/Get-GitHubUserMyGpgKeyById.ps1 index 14ba121f..01ffbe5c 100644 --- a/src/functions/private/Users/GPG-Keys/Get-GitHubUserMyGpgKeyById.ps1 +++ b/src/functions/private/Users/GPG-Keys/Get-GitHubUserMyGpgKeyById.ps1 @@ -34,8 +34,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -57,6 +57,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Users/Get-GitHubAllUser.ps1 b/src/functions/private/Users/Get-GitHubAllUser.ps1 index c85e6284..1a6d095e 100644 --- a/src/functions/private/Users/Get-GitHubAllUser.ps1 +++ b/src/functions/private/Users/Get-GitHubAllUser.ps1 @@ -37,8 +37,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -66,6 +66,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Users/Get-GitHubMyUser.ps1 b/src/functions/private/Users/Get-GitHubMyUser.ps1 index 9287be3f..b58ad6ed 100644 --- a/src/functions/private/Users/Get-GitHubMyUser.ps1 +++ b/src/functions/private/Users/Get-GitHubMyUser.ps1 @@ -27,8 +27,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -50,6 +50,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Users/Get-GitHubUserByName.ps1 b/src/functions/private/Users/Get-GitHubUserByName.ps1 index 4eda5148..be4c82bd 100644 --- a/src/functions/private/Users/Get-GitHubUserByName.ps1 +++ b/src/functions/private/Users/Get-GitHubUserByName.ps1 @@ -45,8 +45,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -68,6 +68,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Users/Keys/Get-GitHubUserKeyForUser.ps1 b/src/functions/private/Users/Keys/Get-GitHubUserKeyForUser.ps1 index ba37c431..ce4ebdcc 100644 --- a/src/functions/private/Users/Keys/Get-GitHubUserKeyForUser.ps1 +++ b/src/functions/private/Users/Keys/Get-GitHubUserKeyForUser.ps1 @@ -37,8 +37,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -65,6 +65,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Users/Keys/Get-GitHubUserMyKey.ps1 b/src/functions/private/Users/Keys/Get-GitHubUserMyKey.ps1 index 4af14278..2ebe8ac8 100644 --- a/src/functions/private/Users/Keys/Get-GitHubUserMyKey.ps1 +++ b/src/functions/private/Users/Keys/Get-GitHubUserMyKey.ps1 @@ -32,8 +32,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -60,6 +60,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Users/Keys/Get-GitHubUserMyKeyById.ps1 b/src/functions/private/Users/Keys/Get-GitHubUserMyKeyById.ps1 index 38c66b58..32642acc 100644 --- a/src/functions/private/Users/Keys/Get-GitHubUserMyKeyById.ps1 +++ b/src/functions/private/Users/Keys/Get-GitHubUserMyKeyById.ps1 @@ -34,8 +34,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -57,6 +57,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Users/SSH-Signing-Keys/Get-GitHubUserMySigningKey.ps1 b/src/functions/private/Users/SSH-Signing-Keys/Get-GitHubUserMySigningKey.ps1 index 77d4120a..30706acd 100644 --- a/src/functions/private/Users/SSH-Signing-Keys/Get-GitHubUserMySigningKey.ps1 +++ b/src/functions/private/Users/SSH-Signing-Keys/Get-GitHubUserMySigningKey.ps1 @@ -32,8 +32,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -60,6 +60,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Users/SSH-Signing-Keys/Get-GitHubUserMySigningKeyById.ps1 b/src/functions/private/Users/SSH-Signing-Keys/Get-GitHubUserMySigningKeyById.ps1 index b95bca44..d4db058f 100644 --- a/src/functions/private/Users/SSH-Signing-Keys/Get-GitHubUserMySigningKeyById.ps1 +++ b/src/functions/private/Users/SSH-Signing-Keys/Get-GitHubUserMySigningKeyById.ps1 @@ -35,8 +35,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -58,6 +58,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Users/SSH-Signing-Keys/Get-GitHubUserSigningKeyForUser.ps1 b/src/functions/private/Users/SSH-Signing-Keys/Get-GitHubUserSigningKeyForUser.ps1 index 4f577e54..fccf461e 100644 --- a/src/functions/private/Users/SSH-Signing-Keys/Get-GitHubUserSigningKeyForUser.ps1 +++ b/src/functions/private/Users/SSH-Signing-Keys/Get-GitHubUserSigningKeyForUser.ps1 @@ -37,8 +37,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -65,6 +65,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Users/Social-Accounts/Get-GitHubMyUserSocials.ps1 b/src/functions/private/Users/Social-Accounts/Get-GitHubMyUserSocials.ps1 index aad55ccd..f9ff2102 100644 --- a/src/functions/private/Users/Social-Accounts/Get-GitHubMyUserSocials.ps1 +++ b/src/functions/private/Users/Social-Accounts/Get-GitHubMyUserSocials.ps1 @@ -30,8 +30,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -58,6 +58,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Users/Social-Accounts/Get-GitHubUserSocialsByName.ps1 b/src/functions/private/Users/Social-Accounts/Get-GitHubUserSocialsByName.ps1 index 48a78c86..4cff51bd 100644 --- a/src/functions/private/Users/Social-Accounts/Get-GitHubUserSocialsByName.ps1 +++ b/src/functions/private/Users/Social-Accounts/Get-GitHubUserSocialsByName.ps1 @@ -33,8 +33,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -56,6 +56,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/private/Utilities/PowerShell/Show-CallStack.ps1 b/src/functions/private/Utilities/PowerShell/Get-PSCallStackPath.ps1 similarity index 72% rename from src/functions/private/Utilities/PowerShell/Show-CallStack.ps1 rename to src/functions/private/Utilities/PowerShell/Get-PSCallStackPath.ps1 index 92315139..6a0ad886 100644 --- a/src/functions/private/Utilities/PowerShell/Show-CallStack.ps1 +++ b/src/functions/private/Utilities/PowerShell/Get-PSCallStackPath.ps1 @@ -1,4 +1,4 @@ -function Show-CallStack { +function Get-PSCallStackPath { <# .SYNOPSIS Create a string representation of the current call stack. @@ -7,30 +7,30 @@ This function creates a string representation of the current call stack. You can use the SkipFirst and SkipLatest parameters to skip the first and last. By default it will skip the first (what called the initial function, typically ), - and the last (the current function, Show-CallStack). + and the last (the current function, Get-PSCallStackPath). .EXAMPLE - Show-CallStack + Get-PSCallStackPath First-Function\Second-Function\Third-Function - Shows the call stack of the last function called, Third-Function, with the first () and last (Show-CallStack) functions removed. + Shows the call stack of the last function called, Third-Function, with the first () and last (Get-PSCallStackPath) functions removed. .EXAMPLE - Show-CallStack -SkipFirst 0 + Get-PSCallStackPath -SkipFirst 0 \First-Function\Second-Function\Third-Function Shows the call stack of the last function called, Third-Function, with the first function included (typically ). .EXAMPLE - Show-CallStack -SkipLatest 0 - First-Function\Second-Function\Third-Function\Show-CallStack + Get-PSCallStackPath -SkipLatest 0 + First-Function\Second-Function\Third-Function\Get-PSCallStackPath - Shows the call stack of the last function called, Third-Function, with the last function included (Show-CallStack). + Shows the call stack of the last function called, Third-Function, with the last function included (Get-PSCallStackPath). #> [CmdletBinding()] param( # Number of the functions to skip from the last function called. - # Last function is this function, Show-CallStack. + # Last function is this function, Get-PSCallStackPath. [Parameter()] [int] $SkipLatest = 1, diff --git a/src/functions/public/API/Invoke-GitHubAPI.ps1 b/src/functions/public/API/Invoke-GitHubAPI.ps1 index b8c9a3b2..e4be2005 100644 --- a/src/functions/public/API/Invoke-GitHubAPI.ps1 +++ b/src/functions/public/API/Invoke-GitHubAPI.ps1 @@ -83,8 +83,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Write-Debug 'Invoking GitHub API...' Write-Debug 'Parameters:' @@ -251,6 +251,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Actions/Disable-GitHubWorkflow.ps1 b/src/functions/public/Actions/Disable-GitHubWorkflow.ps1 index 707afc2e..61cb6367 100644 --- a/src/functions/public/Actions/Disable-GitHubWorkflow.ps1 +++ b/src/functions/public/Actions/Disable-GitHubWorkflow.ps1 @@ -27,8 +27,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT if ([string]::IsNullOrEmpty($Owner)) { @@ -57,6 +57,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Actions/Enable-GitHubWorkflow.ps1 b/src/functions/public/Actions/Enable-GitHubWorkflow.ps1 index 4d7fd43e..b5529881 100644 --- a/src/functions/public/Actions/Enable-GitHubWorkflow.ps1 +++ b/src/functions/public/Actions/Enable-GitHubWorkflow.ps1 @@ -24,8 +24,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT if ([string]::IsNullOrEmpty($Owner)) { @@ -54,6 +54,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Actions/Get-GitHubWorkflow.ps1 b/src/functions/public/Actions/Get-GitHubWorkflow.ps1 index 9cc9cbb5..d6cfa0f5 100644 --- a/src/functions/public/Actions/Get-GitHubWorkflow.ps1 +++ b/src/functions/public/Actions/Get-GitHubWorkflow.ps1 @@ -41,8 +41,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT if ([string]::IsNullOrEmpty($Owner)) { @@ -78,6 +78,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Actions/Get-GitHubWorkflowRun.ps1 b/src/functions/public/Actions/Get-GitHubWorkflowRun.ps1 index c52abf3a..0d989c37 100644 --- a/src/functions/public/Actions/Get-GitHubWorkflowRun.ps1 +++ b/src/functions/public/Actions/Get-GitHubWorkflowRun.ps1 @@ -115,8 +115,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT if ([string]::IsNullOrEmpty($Owner)) { @@ -167,6 +167,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Actions/Get-GitHubWorkflowUsage.ps1 b/src/functions/public/Actions/Get-GitHubWorkflowUsage.ps1 index 96a6bd8f..bd9601b0 100644 --- a/src/functions/public/Actions/Get-GitHubWorkflowUsage.ps1 +++ b/src/functions/public/Actions/Get-GitHubWorkflowUsage.ps1 @@ -35,8 +35,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT if ([string]::IsNullOrEmpty($Owner)) { @@ -68,6 +68,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Actions/Remove-GitHubWorkflowRun.ps1 b/src/functions/public/Actions/Remove-GitHubWorkflowRun.ps1 index bb4336ae..f1c163e7 100644 --- a/src/functions/public/Actions/Remove-GitHubWorkflowRun.ps1 +++ b/src/functions/public/Actions/Remove-GitHubWorkflowRun.ps1 @@ -41,8 +41,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT if ([string]::IsNullOrEmpty($Owner)) { @@ -75,6 +75,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Actions/Start-GitHubWorkflow.ps1 b/src/functions/public/Actions/Start-GitHubWorkflow.ps1 index 1cf704e1..ad00db1c 100644 --- a/src/functions/public/Actions/Start-GitHubWorkflow.ps1 +++ b/src/functions/public/Actions/Start-GitHubWorkflow.ps1 @@ -53,8 +53,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT if ([string]::IsNullOrEmpty($Owner)) { @@ -93,6 +93,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Actions/Start-GitHubWorkflowReRun.ps1 b/src/functions/public/Actions/Start-GitHubWorkflowReRun.ps1 index 7d2105e4..05bfef04 100644 --- a/src/functions/public/Actions/Start-GitHubWorkflowReRun.ps1 +++ b/src/functions/public/Actions/Start-GitHubWorkflowReRun.ps1 @@ -37,8 +37,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT if ([string]::IsNullOrEmpty($Owner)) { @@ -71,6 +71,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Actions/Stop-GitHubWorkflowRun.ps1 b/src/functions/public/Actions/Stop-GitHubWorkflowRun.ps1 index 80bf356d..36c06faf 100644 --- a/src/functions/public/Actions/Stop-GitHubWorkflowRun.ps1 +++ b/src/functions/public/Actions/Stop-GitHubWorkflowRun.ps1 @@ -37,8 +37,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT if ([string]::IsNullOrEmpty($Owner)) { @@ -71,6 +71,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Apps/Get-GitHubAppJSONWebToken.ps1 b/src/functions/public/Apps/Get-GitHubAppJSONWebToken.ps1 index ed637083..24fdbb1d 100644 --- a/src/functions/public/Apps/Get-GitHubAppJSONWebToken.ps1 +++ b/src/functions/public/Apps/Get-GitHubAppJSONWebToken.ps1 @@ -67,8 +67,8 @@ function Get-GitHubAppJSONWebToken { ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" } process { @@ -129,7 +129,7 @@ function Get-GitHubAppJSONWebToken { } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } clean { diff --git a/src/functions/public/Apps/GitHub Apps/Get-GitHubApp.ps1 b/src/functions/public/Apps/GitHub Apps/Get-GitHubApp.ps1 index fba1a6ea..26f91fa7 100644 --- a/src/functions/public/Apps/GitHub Apps/Get-GitHubApp.ps1 +++ b/src/functions/public/Apps/GitHub Apps/Get-GitHubApp.ps1 @@ -40,8 +40,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context if ([string]::IsNullOrEmpty($Owner)) { @@ -71,7 +71,7 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Apps/GitHub Apps/Get-GitHubAppInstallation.ps1 b/src/functions/public/Apps/GitHub Apps/Get-GitHubAppInstallation.ps1 index 4e9a9a86..d65c0e5f 100644 --- a/src/functions/public/Apps/GitHub Apps/Get-GitHubAppInstallation.ps1 +++ b/src/functions/public/Apps/GitHub Apps/Get-GitHubAppInstallation.ps1 @@ -26,8 +26,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType APP } @@ -49,6 +49,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Apps/GitHub Apps/New-GitHubAppInstallationAccessToken.ps1 b/src/functions/public/Apps/GitHub Apps/New-GitHubAppInstallationAccessToken.ps1 index 149706cf..3e09fe39 100644 --- a/src/functions/public/Apps/GitHub Apps/New-GitHubAppInstallationAccessToken.ps1 +++ b/src/functions/public/Apps/GitHub Apps/New-GitHubAppInstallationAccessToken.ps1 @@ -66,8 +66,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType APP } @@ -94,7 +94,7 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } clean { diff --git a/src/functions/public/Apps/Webhooks/Get-GitHubAppWebhookConfiguration.ps1 b/src/functions/public/Apps/Webhooks/Get-GitHubAppWebhookConfiguration.ps1 index 477d31ac..94c3b3f1 100644 --- a/src/functions/public/Apps/Webhooks/Get-GitHubAppWebhookConfiguration.ps1 +++ b/src/functions/public/Apps/Webhooks/Get-GitHubAppWebhookConfiguration.ps1 @@ -27,8 +27,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType APP } @@ -50,7 +50,7 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Apps/Webhooks/Get-GitHubAppWebhookDelivery.ps1 b/src/functions/public/Apps/Webhooks/Get-GitHubAppWebhookDelivery.ps1 index 14ff6896..a548e8e9 100644 --- a/src/functions/public/Apps/Webhooks/Get-GitHubAppWebhookDelivery.ps1 +++ b/src/functions/public/Apps/Webhooks/Get-GitHubAppWebhookDelivery.ps1 @@ -26,8 +26,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType APP } @@ -49,6 +49,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Auth/Connect-GitHubAccount.ps1 b/src/functions/public/Auth/Connect-GitHubAccount.ps1 index a88b87fd..cc5ae25c 100644 --- a/src/functions/public/Auth/Connect-GitHubAccount.ps1 +++ b/src/functions/public/Auth/Connect-GitHubAccount.ps1 @@ -148,8 +148,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" } process { @@ -315,7 +315,7 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } clean { diff --git a/src/functions/public/Auth/Connect-GitHubApp.ps1 b/src/functions/public/Auth/Connect-GitHubApp.ps1 index 905d21fd..457fb779 100644 --- a/src/functions/public/Auth/Connect-GitHubApp.ps1 +++ b/src/functions/public/Auth/Connect-GitHubApp.ps1 @@ -68,8 +68,8 @@ function Connect-GitHubApp { ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" } process { @@ -144,6 +144,6 @@ function Connect-GitHubApp { } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Auth/Context/Get-GitHubContext.ps1 b/src/functions/public/Auth/Context/Get-GitHubContext.ps1 index 41ca9972..cac9e23b 100644 --- a/src/functions/public/Auth/Context/Get-GitHubContext.ps1 +++ b/src/functions/public/Auth/Context/Get-GitHubContext.ps1 @@ -37,8 +37,8 @@ function Get-GitHubContext { ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $null = Get-GitHubConfig } @@ -88,6 +88,6 @@ function Get-GitHubContext { } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Auth/Context/Set-GitHubDefaultContext.ps1 b/src/functions/public/Auth/Context/Set-GitHubDefaultContext.ps1 index b772df12..095ea62e 100644 --- a/src/functions/public/Auth/Context/Set-GitHubDefaultContext.ps1 +++ b/src/functions/public/Auth/Context/Set-GitHubDefaultContext.ps1 @@ -18,8 +18,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context } @@ -30,6 +30,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Auth/Disconnect-GitHubAccount.ps1 b/src/functions/public/Auth/Disconnect-GitHubAccount.ps1 index e18e93ac..28e891ac 100644 --- a/src/functions/public/Auth/Disconnect-GitHubAccount.ps1 +++ b/src/functions/public/Auth/Disconnect-GitHubAccount.ps1 @@ -47,8 +47,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context } @@ -72,6 +72,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Auth/Get-GitHubViewer.ps1 b/src/functions/public/Auth/Get-GitHubViewer.ps1 index f7a896f4..658e4fc3 100644 --- a/src/functions/public/Auth/Get-GitHubViewer.ps1 +++ b/src/functions/public/Auth/Get-GitHubViewer.ps1 @@ -27,8 +27,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context } @@ -50,6 +50,6 @@ query { } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Auth/Update-GitHubUserAccessToken.ps1 b/src/functions/public/Auth/Update-GitHubUserAccessToken.ps1 index 0b0ca815..b104736f 100644 --- a/src/functions/public/Auth/Update-GitHubUserAccessToken.ps1 +++ b/src/functions/public/Auth/Update-GitHubUserAccessToken.ps1 @@ -36,8 +36,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType UAT } @@ -99,6 +99,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Branches/Get-GitHubRepoBranch.ps1 b/src/functions/public/Branches/Get-GitHubRepoBranch.ps1 index c21ac4f5..03002733 100644 --- a/src/functions/public/Branches/Get-GitHubRepoBranch.ps1 +++ b/src/functions/public/Branches/Get-GitHubRepoBranch.ps1 @@ -31,8 +31,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT if ([string]::IsNullOrEmpty($Owner)) { @@ -63,7 +63,7 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Commands/Add-GitHubMask.ps1 b/src/functions/public/Commands/Add-GitHubMask.ps1 index e3ad9e8d..8b156f64 100644 --- a/src/functions/public/Commands/Add-GitHubMask.ps1 +++ b/src/functions/public/Commands/Add-GitHubMask.ps1 @@ -47,8 +47,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" } process { @@ -62,6 +62,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Commands/Add-GitHubSystemPath.ps1 b/src/functions/public/Commands/Add-GitHubSystemPath.ps1 index 30ff6392..2465ac7a 100644 --- a/src/functions/public/Commands/Add-GitHubSystemPath.ps1 +++ b/src/functions/public/Commands/Add-GitHubSystemPath.ps1 @@ -25,8 +25,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" } process { @@ -41,6 +41,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Commands/Disable-GitHubCommand.ps1 b/src/functions/public/Commands/Disable-GitHubCommand.ps1 index b8644631..0c8a6e1c 100644 --- a/src/functions/public/Commands/Disable-GitHubCommand.ps1 +++ b/src/functions/public/Commands/Disable-GitHubCommand.ps1 @@ -35,8 +35,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" } process { @@ -52,6 +52,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Commands/Enable-GitHubCommand.ps1 b/src/functions/public/Commands/Enable-GitHubCommand.ps1 index f3339f84..d1a0e6ee 100644 --- a/src/functions/public/Commands/Enable-GitHubCommand.ps1 +++ b/src/functions/public/Commands/Enable-GitHubCommand.ps1 @@ -34,8 +34,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" } process { @@ -51,6 +51,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Commands/Get-GitHubOutput.ps1 b/src/functions/public/Commands/Get-GitHubOutput.ps1 index 1d2e44ec..ed7b7ff6 100644 --- a/src/functions/public/Commands/Get-GitHubOutput.ps1 +++ b/src/functions/public/Commands/Get-GitHubOutput.ps1 @@ -41,8 +41,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" } process { @@ -58,6 +58,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Commands/Set-GitHubEnvironmentVariable.ps1 b/src/functions/public/Commands/Set-GitHubEnvironmentVariable.ps1 index e77ff3d0..204d4e17 100644 --- a/src/functions/public/Commands/Set-GitHubEnvironmentVariable.ps1 +++ b/src/functions/public/Commands/Set-GitHubEnvironmentVariable.ps1 @@ -35,8 +35,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" } process { @@ -56,6 +56,6 @@ $guid } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Commands/Set-GitHubLogGroup.ps1 b/src/functions/public/Commands/Set-GitHubLogGroup.ps1 index 5f402e7e..4e1c4865 100644 --- a/src/functions/public/Commands/Set-GitHubLogGroup.ps1 +++ b/src/functions/public/Commands/Set-GitHubLogGroup.ps1 @@ -41,8 +41,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" } process { @@ -56,6 +56,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Commands/Set-GitHubNoCommandGroup.ps1 b/src/functions/public/Commands/Set-GitHubNoCommandGroup.ps1 index 9f18edde..4384c7a9 100644 --- a/src/functions/public/Commands/Set-GitHubNoCommandGroup.ps1 +++ b/src/functions/public/Commands/Set-GitHubNoCommandGroup.ps1 @@ -43,8 +43,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" } process { @@ -60,6 +60,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Commands/Set-GitHubOutput.ps1 b/src/functions/public/Commands/Set-GitHubOutput.ps1 index 6bff0674..b29f7a57 100644 --- a/src/functions/public/Commands/Set-GitHubOutput.ps1 +++ b/src/functions/public/Commands/Set-GitHubOutput.ps1 @@ -37,8 +37,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" } process { @@ -84,6 +84,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Commands/Set-GitHubStepSummary.ps1 b/src/functions/public/Commands/Set-GitHubStepSummary.ps1 index 7cf6ea10..d04e0dd2 100644 --- a/src/functions/public/Commands/Set-GitHubStepSummary.ps1 +++ b/src/functions/public/Commands/Set-GitHubStepSummary.ps1 @@ -43,8 +43,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" } process { @@ -60,6 +60,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Commands/Start-GitHubLogGroup.ps1 b/src/functions/public/Commands/Start-GitHubLogGroup.ps1 index 7d221e17..00f4f00a 100644 --- a/src/functions/public/Commands/Start-GitHubLogGroup.ps1 +++ b/src/functions/public/Commands/Start-GitHubLogGroup.ps1 @@ -28,8 +28,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" } process { @@ -41,6 +41,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Commands/Stop-GitHubLogGroup.ps1 b/src/functions/public/Commands/Stop-GitHubLogGroup.ps1 index 1755ff4a..2d5b8220 100644 --- a/src/functions/public/Commands/Stop-GitHubLogGroup.ps1 +++ b/src/functions/public/Commands/Stop-GitHubLogGroup.ps1 @@ -24,8 +24,8 @@ param() begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" } process { @@ -37,6 +37,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Commands/Write-GitHubDebug.ps1 b/src/functions/public/Commands/Write-GitHubDebug.ps1 index e1e4dceb..e473db31 100644 --- a/src/functions/public/Commands/Write-GitHubDebug.ps1 +++ b/src/functions/public/Commands/Write-GitHubDebug.ps1 @@ -36,8 +36,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" } process { @@ -53,6 +53,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Commands/Write-GitHubError.ps1 b/src/functions/public/Commands/Write-GitHubError.ps1 index 9f1dae0c..3ab1c6d8 100644 --- a/src/functions/public/Commands/Write-GitHubError.ps1 +++ b/src/functions/public/Commands/Write-GitHubError.ps1 @@ -56,8 +56,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" } process { @@ -73,6 +73,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Commands/Write-GitHubNotice.ps1 b/src/functions/public/Commands/Write-GitHubNotice.ps1 index 3413690c..d206f439 100644 --- a/src/functions/public/Commands/Write-GitHubNotice.ps1 +++ b/src/functions/public/Commands/Write-GitHubNotice.ps1 @@ -56,8 +56,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" } process { @@ -73,6 +73,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Commands/Write-GitHubWarning.ps1 b/src/functions/public/Commands/Write-GitHubWarning.ps1 index 6209b00a..22de869a 100644 --- a/src/functions/public/Commands/Write-GitHubWarning.ps1 +++ b/src/functions/public/Commands/Write-GitHubWarning.ps1 @@ -56,8 +56,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" } process { @@ -73,6 +73,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Config/Get-GitHubConfig.ps1 b/src/functions/public/Config/Get-GitHubConfig.ps1 index 102ea6e9..81a02784 100644 --- a/src/functions/public/Config/Get-GitHubConfig.ps1 +++ b/src/functions/public/Config/Get-GitHubConfig.ps1 @@ -22,8 +22,8 @@ function Get-GitHubConfig { ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" Initialize-GitHubConfig } @@ -40,6 +40,6 @@ function Get-GitHubConfig { } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Config/Remove-GitHubConfig.ps1 b/src/functions/public/Config/Remove-GitHubConfig.ps1 index b1decc82..a9bd256c 100644 --- a/src/functions/public/Config/Remove-GitHubConfig.ps1 +++ b/src/functions/public/Config/Remove-GitHubConfig.ps1 @@ -21,8 +21,8 @@ function Remove-GitHubConfig { ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" Initialize-GitHubConfig } @@ -40,6 +40,6 @@ function Remove-GitHubConfig { } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Config/Reset-GitHubConfig.ps1 b/src/functions/public/Config/Reset-GitHubConfig.ps1 index 06befa70..8b2d979f 100644 --- a/src/functions/public/Config/Reset-GitHubConfig.ps1 +++ b/src/functions/public/Config/Reset-GitHubConfig.ps1 @@ -16,8 +16,8 @@ param () begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" } process { @@ -32,6 +32,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Config/Set-GitHubConfig.ps1 b/src/functions/public/Config/Set-GitHubConfig.ps1 index 7bf0ace4..a1bec6c8 100644 --- a/src/functions/public/Config/Set-GitHubConfig.ps1 +++ b/src/functions/public/Config/Set-GitHubConfig.ps1 @@ -25,8 +25,8 @@ function Set-GitHubConfig { ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" Initialize-GitHubConfig } @@ -44,6 +44,6 @@ function Set-GitHubConfig { } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Emojis/Get-GitHubEmoji.ps1 b/src/functions/public/Emojis/Get-GitHubEmoji.ps1 index 21183390..3db00fbb 100644 --- a/src/functions/public/Emojis/Get-GitHubEmoji.ps1 +++ b/src/functions/public/Emojis/Get-GitHubEmoji.ps1 @@ -33,8 +33,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -64,6 +64,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Enterprise/Get-GitHubEnterpriseInstallableOrganization.ps1 b/src/functions/public/Enterprise/Get-GitHubEnterpriseInstallableOrganization.ps1 index 0248a14a..ebe26471 100644 --- a/src/functions/public/Enterprise/Get-GitHubEnterpriseInstallableOrganization.ps1 +++ b/src/functions/public/Enterprise/Get-GitHubEnterpriseInstallableOrganization.ps1 @@ -25,8 +25,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT if ([string]::IsNullOrEmpty($Enterprise)) { @@ -52,6 +52,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Enterprise/Get-GitHubEnterpriseOrganization.ps1 b/src/functions/public/Enterprise/Get-GitHubEnterpriseOrganization.ps1 index 025cf9e7..819420e2 100644 --- a/src/functions/public/Enterprise/Get-GitHubEnterpriseOrganization.ps1 +++ b/src/functions/public/Enterprise/Get-GitHubEnterpriseOrganization.ps1 @@ -21,8 +21,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT if ([string]::IsNullOrEmpty($Enterprise)) { @@ -88,6 +88,6 @@ query(`$enterpriseSlug: String!, `$first: Int = 100, `$after: String) { } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Enterprise/Install-GitHubAppOnEnterpriseOrganization.ps1 b/src/functions/public/Enterprise/Install-GitHubAppOnEnterpriseOrganization.ps1 index acf89b1d..69455a25 100644 --- a/src/functions/public/Enterprise/Install-GitHubAppOnEnterpriseOrganization.ps1 +++ b/src/functions/public/Enterprise/Install-GitHubAppOnEnterpriseOrganization.ps1 @@ -43,8 +43,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT if ([string]::IsNullOrEmpty($Enterprise)) { @@ -77,6 +77,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Git/Get-GitHubGitConfig.ps1 b/src/functions/public/Git/Get-GitHubGitConfig.ps1 index 0a2b01f3..0d7da767 100644 --- a/src/functions/public/Git/Get-GitHubGitConfig.ps1 +++ b/src/functions/public/Git/Get-GitHubGitConfig.ps1 @@ -16,8 +16,8 @@ param() begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" } process { @@ -42,6 +42,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Git/Set-GitHubGitConfig.ps1 b/src/functions/public/Git/Set-GitHubGitConfig.ps1 index 8cd971ec..3778ca7b 100644 --- a/src/functions/public/Git/Set-GitHubGitConfig.ps1 +++ b/src/functions/public/Git/Set-GitHubGitConfig.ps1 @@ -25,8 +25,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context } @@ -58,6 +58,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Gitignore/Get-GitHubGitignore.ps1 b/src/functions/public/Gitignore/Get-GitHubGitignore.ps1 index 7f34aa6c..4dacac03 100644 --- a/src/functions/public/Gitignore/Get-GitHubGitignore.ps1 +++ b/src/functions/public/Gitignore/Get-GitHubGitignore.ps1 @@ -49,8 +49,8 @@ filter Get-GitHubGitignore { } begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT if ([string]::IsNullOrEmpty($Enterprise)) { @@ -76,6 +76,6 @@ filter Get-GitHubGitignore { } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/GraphQL/Invoke-GitHubGraphQLQuery.ps1 b/src/functions/public/GraphQL/Invoke-GitHubGraphQLQuery.ps1 index 66069889..49e6a887 100644 --- a/src/functions/public/GraphQL/Invoke-GitHubGraphQLQuery.ps1 +++ b/src/functions/public/GraphQL/Invoke-GitHubGraphQLQuery.ps1 @@ -26,8 +26,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -53,6 +53,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/License/Get-GitHubLicense.ps1 b/src/functions/public/License/Get-GitHubLicense.ps1 index 34f5ce2e..837aa368 100644 --- a/src/functions/public/License/Get-GitHubLicense.ps1 +++ b/src/functions/public/License/Get-GitHubLicense.ps1 @@ -67,8 +67,8 @@ filter Get-GitHubLicense { } begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT if ([string]::IsNullOrEmpty($Owner)) { @@ -102,6 +102,6 @@ filter Get-GitHubLicense { } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Markdown/Get-GitHubMarkdown.ps1 b/src/functions/public/Markdown/Get-GitHubMarkdown.ps1 index d09230e2..bf7a64dd 100644 --- a/src/functions/public/Markdown/Get-GitHubMarkdown.ps1 +++ b/src/functions/public/Markdown/Get-GitHubMarkdown.ps1 @@ -43,8 +43,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -73,6 +73,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Markdown/Get-GitHubMarkdownRaw.ps1 b/src/functions/public/Markdown/Get-GitHubMarkdownRaw.ps1 index 638d621f..e6cd8850 100644 --- a/src/functions/public/Markdown/Get-GitHubMarkdownRaw.ps1 +++ b/src/functions/public/Markdown/Get-GitHubMarkdownRaw.ps1 @@ -30,8 +30,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -55,6 +55,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Meta/Get-GitHubApiVersion.ps1 b/src/functions/public/Meta/Get-GitHubApiVersion.ps1 index 046bcb2d..6b97d9e2 100644 --- a/src/functions/public/Meta/Get-GitHubApiVersion.ps1 +++ b/src/functions/public/Meta/Get-GitHubApiVersion.ps1 @@ -24,8 +24,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -47,6 +47,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Meta/Get-GitHubMeta.ps1 b/src/functions/public/Meta/Get-GitHubMeta.ps1 index c4059246..1aa4ece0 100644 --- a/src/functions/public/Meta/Get-GitHubMeta.ps1 +++ b/src/functions/public/Meta/Get-GitHubMeta.ps1 @@ -32,8 +32,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -55,6 +55,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Meta/Get-GitHubOctocat.ps1 b/src/functions/public/Meta/Get-GitHubOctocat.ps1 index 749873b8..9ea7534f 100644 --- a/src/functions/public/Meta/Get-GitHubOctocat.ps1 +++ b/src/functions/public/Meta/Get-GitHubOctocat.ps1 @@ -35,8 +35,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -63,6 +63,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Meta/Get-GitHubRoot.ps1 b/src/functions/public/Meta/Get-GitHubRoot.ps1 index df459c00..566100b1 100644 --- a/src/functions/public/Meta/Get-GitHubRoot.ps1 +++ b/src/functions/public/Meta/Get-GitHubRoot.ps1 @@ -23,8 +23,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -46,6 +46,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Meta/Get-GitHubZen.ps1 b/src/functions/public/Meta/Get-GitHubZen.ps1 index 04193834..63cb0015 100644 --- a/src/functions/public/Meta/Get-GitHubZen.ps1 +++ b/src/functions/public/Meta/Get-GitHubZen.ps1 @@ -23,8 +23,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -46,6 +46,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Organization/Get-GitHubOrganization.ps1 b/src/functions/public/Organization/Get-GitHubOrganization.ps1 index 79d560c4..a58bd80b 100644 --- a/src/functions/public/Organization/Get-GitHubOrganization.ps1 +++ b/src/functions/public/Organization/Get-GitHubOrganization.ps1 @@ -80,8 +80,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT @@ -114,6 +114,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Organization/Get-GitHubOrganizationAppInstallation.ps1 b/src/functions/public/Organization/Get-GitHubOrganizationAppInstallation.ps1 index 42ae2687..3a59def9 100644 --- a/src/functions/public/Organization/Get-GitHubOrganizationAppInstallation.ps1 +++ b/src/functions/public/Organization/Get-GitHubOrganizationAppInstallation.ps1 @@ -42,8 +42,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT @@ -75,6 +75,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Organization/Members/Get-GitHubOrganizationMember.ps1 b/src/functions/public/Organization/Members/Get-GitHubOrganizationMember.ps1 index 4a553d4c..efd7b1ba 100644 --- a/src/functions/public/Organization/Members/Get-GitHubOrganizationMember.ps1 +++ b/src/functions/public/Organization/Members/Get-GitHubOrganizationMember.ps1 @@ -42,8 +42,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT @@ -77,6 +77,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Organization/Members/Get-GitHubOrganizationPendingInvitation.ps1 b/src/functions/public/Organization/Members/Get-GitHubOrganizationPendingInvitation.ps1 index 8209f92f..7e0c0feb 100644 --- a/src/functions/public/Organization/Members/Get-GitHubOrganizationPendingInvitation.ps1 +++ b/src/functions/public/Organization/Members/Get-GitHubOrganizationPendingInvitation.ps1 @@ -41,8 +41,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT @@ -76,6 +76,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Organization/Members/New-GitHubOrganizationInvitation.ps1 b/src/functions/public/Organization/Members/New-GitHubOrganizationInvitation.ps1 index eff5116b..c2b34e17 100644 --- a/src/functions/public/Organization/Members/New-GitHubOrganizationInvitation.ps1 +++ b/src/functions/public/Organization/Members/New-GitHubOrganizationInvitation.ps1 @@ -60,8 +60,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT @@ -99,6 +99,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Organization/Remove-GitHubOrganization.ps1 b/src/functions/public/Organization/Remove-GitHubOrganization.ps1 index 6ed2bf9a..4bcdae43 100644 --- a/src/functions/public/Organization/Remove-GitHubOrganization.ps1 +++ b/src/functions/public/Organization/Remove-GitHubOrganization.ps1 @@ -38,8 +38,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT @@ -68,6 +68,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Organization/Set-GitHubOrganization.ps1 b/src/functions/public/Organization/Set-GitHubOrganization.ps1 index 8aa4aec6..c067fd5a 100644 --- a/src/functions/public/Organization/Set-GitHubOrganization.ps1 +++ b/src/functions/public/Organization/Set-GitHubOrganization.ps1 @@ -228,8 +228,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT @@ -291,6 +291,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Organization/Set-GitHubOrganizationSecurityFeature.ps1 b/src/functions/public/Organization/Set-GitHubOrganizationSecurityFeature.ps1 index 38532552..89b1e498 100644 --- a/src/functions/public/Organization/Set-GitHubOrganizationSecurityFeature.ps1 +++ b/src/functions/public/Organization/Set-GitHubOrganizationSecurityFeature.ps1 @@ -75,8 +75,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT @@ -110,6 +110,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Rate-Limit/Get-GitHubRateLimit.ps1 b/src/functions/public/Rate-Limit/Get-GitHubRateLimit.ps1 index 9c08765e..4fbb270c 100644 --- a/src/functions/public/Rate-Limit/Get-GitHubRateLimit.ps1 +++ b/src/functions/public/Rate-Limit/Get-GitHubRateLimit.ps1 @@ -41,8 +41,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -64,6 +64,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Releases/Assets/Add-GitHubReleaseAsset.ps1 b/src/functions/public/Releases/Assets/Add-GitHubReleaseAsset.ps1 index c0de009f..720a682d 100644 --- a/src/functions/public/Releases/Assets/Add-GitHubReleaseAsset.ps1 +++ b/src/functions/public/Releases/Assets/Add-GitHubReleaseAsset.ps1 @@ -84,8 +84,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT @@ -156,6 +156,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Releases/Assets/Get-GitHubReleaseAsset.ps1 b/src/functions/public/Releases/Assets/Get-GitHubReleaseAsset.ps1 index 41509ce4..83cc166b 100644 --- a/src/functions/public/Releases/Assets/Get-GitHubReleaseAsset.ps1 +++ b/src/functions/public/Releases/Assets/Get-GitHubReleaseAsset.ps1 @@ -54,8 +54,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT @@ -84,6 +84,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Releases/Assets/Remove-GitHubReleaseAsset.ps1 b/src/functions/public/Releases/Assets/Remove-GitHubReleaseAsset.ps1 index b16109b1..2279bf07 100644 --- a/src/functions/public/Releases/Assets/Remove-GitHubReleaseAsset.ps1 +++ b/src/functions/public/Releases/Assets/Remove-GitHubReleaseAsset.ps1 @@ -37,8 +37,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT @@ -72,6 +72,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Releases/Assets/Set-GitHubReleaseAsset.ps1 b/src/functions/public/Releases/Assets/Set-GitHubReleaseAsset.ps1 index f48c26b7..72ca1921 100644 --- a/src/functions/public/Releases/Assets/Set-GitHubReleaseAsset.ps1 +++ b/src/functions/public/Releases/Assets/Set-GitHubReleaseAsset.ps1 @@ -50,8 +50,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT @@ -93,6 +93,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Releases/Releases/Get-GitHubRelease.ps1 b/src/functions/public/Releases/Releases/Get-GitHubRelease.ps1 index bb428b11..d6ac5412 100644 --- a/src/functions/public/Releases/Releases/Get-GitHubRelease.ps1 +++ b/src/functions/public/Releases/Releases/Get-GitHubRelease.ps1 @@ -79,8 +79,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT @@ -117,6 +117,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Releases/Releases/New-GitHubRelease.ps1 b/src/functions/public/Releases/Releases/New-GitHubRelease.ps1 index 060a4f60..8378e2c6 100644 --- a/src/functions/public/Releases/Releases/New-GitHubRelease.ps1 +++ b/src/functions/public/Releases/Releases/New-GitHubRelease.ps1 @@ -84,8 +84,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT @@ -133,6 +133,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Releases/Releases/New-GitHubReleaseNote.ps1 b/src/functions/public/Releases/Releases/New-GitHubReleaseNote.ps1 index 9ae5c077..2bdf7fe5 100644 --- a/src/functions/public/Releases/Releases/New-GitHubReleaseNote.ps1 +++ b/src/functions/public/Releases/Releases/New-GitHubReleaseNote.ps1 @@ -98,8 +98,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT @@ -141,6 +141,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Releases/Releases/Remove-GitHubRelease.ps1 b/src/functions/public/Releases/Releases/Remove-GitHubRelease.ps1 index 4e4dc91f..a1e5407a 100644 --- a/src/functions/public/Releases/Releases/Remove-GitHubRelease.ps1 +++ b/src/functions/public/Releases/Releases/Remove-GitHubRelease.ps1 @@ -40,8 +40,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT @@ -75,6 +75,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Releases/Releases/Set-GitHubRelease.ps1 b/src/functions/public/Releases/Releases/Set-GitHubRelease.ps1 index cda4182b..a0768d62 100644 --- a/src/functions/public/Releases/Releases/Set-GitHubRelease.ps1 +++ b/src/functions/public/Releases/Releases/Set-GitHubRelease.ps1 @@ -81,8 +81,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT @@ -129,6 +129,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Repositories/Autolinks/Get-GitHubRepositoryAutolink.ps1 b/src/functions/public/Repositories/Autolinks/Get-GitHubRepositoryAutolink.ps1 index 025f9299..81d9e24b 100644 --- a/src/functions/public/Repositories/Autolinks/Get-GitHubRepositoryAutolink.ps1 +++ b/src/functions/public/Repositories/Autolinks/Get-GitHubRepositoryAutolink.ps1 @@ -50,8 +50,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT @@ -82,6 +82,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Repositories/Autolinks/New-GitHubRepositoryAutolink.ps1 b/src/functions/public/Repositories/Autolinks/New-GitHubRepositoryAutolink.ps1 index 2f4a6ed6..e97fd0bb 100644 --- a/src/functions/public/Repositories/Autolinks/New-GitHubRepositoryAutolink.ps1 +++ b/src/functions/public/Repositories/Autolinks/New-GitHubRepositoryAutolink.ps1 @@ -50,8 +50,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT @@ -92,6 +92,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Repositories/Autolinks/Remove-GitHubRepositoryAutolink.ps1 b/src/functions/public/Repositories/Autolinks/Remove-GitHubRepositoryAutolink.ps1 index b86a5434..628f4742 100644 --- a/src/functions/public/Repositories/Autolinks/Remove-GitHubRepositoryAutolink.ps1 +++ b/src/functions/public/Repositories/Autolinks/Remove-GitHubRepositoryAutolink.ps1 @@ -41,8 +41,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT @@ -77,6 +77,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Repositories/CustomProperties/Get-GitHubRepositoryCustomProperty.ps1 b/src/functions/public/Repositories/CustomProperties/Get-GitHubRepositoryCustomProperty.ps1 index 0c9099de..296ac746 100644 --- a/src/functions/public/Repositories/CustomProperties/Get-GitHubRepositoryCustomProperty.ps1 +++ b/src/functions/public/Repositories/CustomProperties/Get-GitHubRepositoryCustomProperty.ps1 @@ -37,8 +37,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT @@ -70,6 +70,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Repositories/Repositories/Disable-GitHubRepositoryPrivateVulnerabilityReporting.ps1 b/src/functions/public/Repositories/Repositories/Disable-GitHubRepositoryPrivateVulnerabilityReporting.ps1 index 62555e53..780151af 100644 --- a/src/functions/public/Repositories/Repositories/Disable-GitHubRepositoryPrivateVulnerabilityReporting.ps1 +++ b/src/functions/public/Repositories/Repositories/Disable-GitHubRepositoryPrivateVulnerabilityReporting.ps1 @@ -36,8 +36,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT @@ -71,6 +71,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Repositories/Repositories/Disable-GitHubRepositorySecurityFix.ps1 b/src/functions/public/Repositories/Repositories/Disable-GitHubRepositorySecurityFix.ps1 index 344ded1a..ae0b6169 100644 --- a/src/functions/public/Repositories/Repositories/Disable-GitHubRepositorySecurityFix.ps1 +++ b/src/functions/public/Repositories/Repositories/Disable-GitHubRepositorySecurityFix.ps1 @@ -36,8 +36,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT @@ -71,6 +71,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Repositories/Repositories/Disable-GitHubRepositoryVulnerabilityAlert.ps1 b/src/functions/public/Repositories/Repositories/Disable-GitHubRepositoryVulnerabilityAlert.ps1 index f99a5d7c..24df3eb8 100644 --- a/src/functions/public/Repositories/Repositories/Disable-GitHubRepositoryVulnerabilityAlert.ps1 +++ b/src/functions/public/Repositories/Repositories/Disable-GitHubRepositoryVulnerabilityAlert.ps1 @@ -35,8 +35,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT @@ -70,6 +70,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Repositories/Repositories/Enable-GitHubRepositoryPrivateVulnerabilityReporting.ps1 b/src/functions/public/Repositories/Repositories/Enable-GitHubRepositoryPrivateVulnerabilityReporting.ps1 index ebaf8cb9..82b852c0 100644 --- a/src/functions/public/Repositories/Repositories/Enable-GitHubRepositoryPrivateVulnerabilityReporting.ps1 +++ b/src/functions/public/Repositories/Repositories/Enable-GitHubRepositoryPrivateVulnerabilityReporting.ps1 @@ -36,8 +36,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT @@ -71,6 +71,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Repositories/Repositories/Enable-GitHubRepositorySecurityFix.ps1 b/src/functions/public/Repositories/Repositories/Enable-GitHubRepositorySecurityFix.ps1 index 9d9b1154..c69b52b9 100644 --- a/src/functions/public/Repositories/Repositories/Enable-GitHubRepositorySecurityFix.ps1 +++ b/src/functions/public/Repositories/Repositories/Enable-GitHubRepositorySecurityFix.ps1 @@ -36,8 +36,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT @@ -71,6 +71,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Repositories/Repositories/Enable-GitHubRepositoryVulnerabilityAlert.ps1 b/src/functions/public/Repositories/Repositories/Enable-GitHubRepositoryVulnerabilityAlert.ps1 index 95324abf..6c7afca7 100644 --- a/src/functions/public/Repositories/Repositories/Enable-GitHubRepositoryVulnerabilityAlert.ps1 +++ b/src/functions/public/Repositories/Repositories/Enable-GitHubRepositoryVulnerabilityAlert.ps1 @@ -36,8 +36,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT @@ -71,6 +71,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Repositories/Repositories/Get-GitHubRepository.ps1 b/src/functions/public/Repositories/Repositories/Get-GitHubRepository.ps1 index 8f191450..40ef7a5d 100644 --- a/src/functions/public/Repositories/Repositories/Get-GitHubRepository.ps1 +++ b/src/functions/public/Repositories/Repositories/Get-GitHubRepository.ps1 @@ -162,8 +162,8 @@ filter Get-GitHubRepository { } begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT @@ -193,7 +193,6 @@ filter Get-GitHubRepository { Since = $Since Before = $Before } - $params | Remove-HashtableEntry -NullOrEmptyValues Get-GitHubMyRepositories @params } 'MyRepos_Aff-Vis' { @@ -206,7 +205,6 @@ filter Get-GitHubRepository { Since = $Since Before = $Before } - $params | Remove-HashtableEntry -NullOrEmptyValues Get-GitHubMyRepositories @params } 'ByName' { @@ -214,14 +212,12 @@ filter Get-GitHubRepository { Owner = $Owner Repo = $Repo } - $params | Remove-HashtableEntry -NullOrEmptyValues Get-GitHubRepositoryByName @params } 'ListByID' { $params += @{ Since = $SinceID } - $params | Remove-HashtableEntry -NullOrEmptyValues Get-GitHubRepositoryListByID @params } 'ListByOrg' { @@ -232,7 +228,6 @@ filter Get-GitHubRepository { Direction = $Direction PerPage = $PerPage } - $params | Remove-HashtableEntry -NullOrEmptyValues Get-GitHubRepositoryListByOrg @params } 'ListByUser' { @@ -243,7 +238,6 @@ filter Get-GitHubRepository { Direction = $Direction PerPage = $PerPage } - $params | Remove-HashtableEntry -NullOrEmptyValues Get-GitHubRepositoryListByUser @params } } @@ -253,6 +247,6 @@ filter Get-GitHubRepository { } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryActivity.ps1 b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryActivity.ps1 index 8a7553b9..3bd3a75f 100644 --- a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryActivity.ps1 +++ b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryActivity.ps1 @@ -110,8 +110,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT @@ -156,6 +156,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryCodeownersError.ps1 b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryCodeownersError.ps1 index 312b4c76..1fd3d896 100644 --- a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryCodeownersError.ps1 +++ b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryCodeownersError.ps1 @@ -42,8 +42,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT @@ -81,6 +81,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryContributor.ps1 b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryContributor.ps1 index 810601ce..6bcd2a7d 100644 --- a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryContributor.ps1 +++ b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryContributor.ps1 @@ -47,8 +47,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT @@ -87,6 +87,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryFork.ps1 b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryFork.ps1 index 260c7687..e4aa5212 100644 --- a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryFork.ps1 +++ b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryFork.ps1 @@ -43,8 +43,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT @@ -83,6 +83,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryLanguage.ps1 b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryLanguage.ps1 index 01a41ef1..73dd8b74 100644 --- a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryLanguage.ps1 +++ b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryLanguage.ps1 @@ -35,8 +35,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT @@ -68,6 +68,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Repositories/Repositories/Get-GitHubRepositorySecurityFix.ps1 b/src/functions/public/Repositories/Repositories/Get-GitHubRepositorySecurityFix.ps1 index 4f8fb7e8..cd927d9f 100644 --- a/src/functions/public/Repositories/Repositories/Get-GitHubRepositorySecurityFix.ps1 +++ b/src/functions/public/Repositories/Repositories/Get-GitHubRepositorySecurityFix.ps1 @@ -37,8 +37,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT @@ -70,6 +70,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryTag.ps1 b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryTag.ps1 index 44c10791..20c1d86a 100644 --- a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryTag.ps1 +++ b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryTag.ps1 @@ -39,8 +39,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT @@ -77,6 +77,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryTeam.ps1 b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryTeam.ps1 index 6984d444..2ddc6e7c 100644 --- a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryTeam.ps1 +++ b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryTeam.ps1 @@ -47,8 +47,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT @@ -85,6 +85,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryTopic.ps1 b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryTopic.ps1 index ec156fe3..f32dec85 100644 --- a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryTopic.ps1 +++ b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryTopic.ps1 @@ -35,8 +35,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT @@ -73,6 +73,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Repositories/Repositories/Move-GitHubRepository.ps1 b/src/functions/public/Repositories/Repositories/Move-GitHubRepository.ps1 index f106e23f..442394f1 100644 --- a/src/functions/public/Repositories/Repositories/Move-GitHubRepository.ps1 +++ b/src/functions/public/Repositories/Repositories/Move-GitHubRepository.ps1 @@ -53,8 +53,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT @@ -94,6 +94,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Repositories/Repositories/New-GitHubRepository.ps1 b/src/functions/public/Repositories/Repositories/New-GitHubRepository.ps1 index 4d23fc04..8f4685d0 100644 --- a/src/functions/public/Repositories/Repositories/New-GitHubRepository.ps1 +++ b/src/functions/public/Repositories/Repositories/New-GitHubRepository.ps1 @@ -328,8 +328,8 @@ filter New-GitHubRepository { } begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT @@ -425,6 +425,6 @@ filter New-GitHubRepository { } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Repositories/Repositories/Remove-GitHubRepository.ps1 b/src/functions/public/Repositories/Repositories/Remove-GitHubRepository.ps1 index 8f673db6..568a69aa 100644 --- a/src/functions/public/Repositories/Repositories/Remove-GitHubRepository.ps1 +++ b/src/functions/public/Repositories/Repositories/Remove-GitHubRepository.ps1 @@ -37,8 +37,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT @@ -72,6 +72,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Repositories/Repositories/Set-GitHubRepositoryTopic.ps1 b/src/functions/public/Repositories/Repositories/Set-GitHubRepositoryTopic.ps1 index cb15c9b4..9c6e4a23 100644 --- a/src/functions/public/Repositories/Repositories/Set-GitHubRepositoryTopic.ps1 +++ b/src/functions/public/Repositories/Repositories/Set-GitHubRepositoryTopic.ps1 @@ -37,8 +37,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT @@ -77,6 +77,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Repositories/Repositories/Start-GitHubRepositoryEvent.ps1 b/src/functions/public/Repositories/Repositories/Start-GitHubRepositoryEvent.ps1 index 001bf49d..c835d709 100644 --- a/src/functions/public/Repositories/Repositories/Start-GitHubRepositoryEvent.ps1 +++ b/src/functions/public/Repositories/Repositories/Start-GitHubRepositoryEvent.ps1 @@ -70,8 +70,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT @@ -110,6 +110,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Repositories/Repositories/Test-GitHubRepositoryVulnerabilityAlert.ps1 b/src/functions/public/Repositories/Repositories/Test-GitHubRepositoryVulnerabilityAlert.ps1 index af470475..14d06618 100644 --- a/src/functions/public/Repositories/Repositories/Test-GitHubRepositoryVulnerabilityAlert.ps1 +++ b/src/functions/public/Repositories/Repositories/Test-GitHubRepositoryVulnerabilityAlert.ps1 @@ -37,8 +37,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT @@ -72,6 +72,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Repositories/Repositories/Update-GitHubRepository.ps1 b/src/functions/public/Repositories/Repositories/Update-GitHubRepository.ps1 index f0f8c9fc..a9514f5e 100644 --- a/src/functions/public/Repositories/Repositories/Update-GitHubRepository.ps1 +++ b/src/functions/public/Repositories/Repositories/Update-GitHubRepository.ps1 @@ -178,8 +178,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT @@ -250,6 +250,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuite.ps1 b/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuite.ps1 index 5a076609..64a40b3f 100644 --- a/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuite.ps1 +++ b/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuite.ps1 @@ -83,8 +83,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT @@ -131,6 +131,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuiteById.ps1 b/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuiteById.ps1 index d0e341fe..0ef21c33 100644 --- a/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuiteById.ps1 +++ b/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuiteById.ps1 @@ -39,8 +39,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT @@ -72,6 +72,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuiteList.ps1 b/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuiteList.ps1 index 069c8ab8..03304a13 100644 --- a/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuiteList.ps1 +++ b/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuiteList.ps1 @@ -70,8 +70,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT @@ -113,6 +113,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Repositories/Tags/Get-GitHubRepositoryTagProtection.ps1 b/src/functions/public/Repositories/Tags/Get-GitHubRepositoryTagProtection.ps1 index 683018d9..5a955a25 100644 --- a/src/functions/public/Repositories/Tags/Get-GitHubRepositoryTagProtection.ps1 +++ b/src/functions/public/Repositories/Tags/Get-GitHubRepositoryTagProtection.ps1 @@ -36,8 +36,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT @@ -69,6 +69,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Repositories/Tags/New-GitHubRepositoryTagProtection.ps1 b/src/functions/public/Repositories/Tags/New-GitHubRepositoryTagProtection.ps1 index c7e69c21..73002dc4 100644 --- a/src/functions/public/Repositories/Tags/New-GitHubRepositoryTagProtection.ps1 +++ b/src/functions/public/Repositories/Tags/New-GitHubRepositoryTagProtection.ps1 @@ -38,8 +38,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT @@ -78,6 +78,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Repositories/Tags/Remove-GitHubRepositoryTagProtection.ps1 b/src/functions/public/Repositories/Tags/Remove-GitHubRepositoryTagProtection.ps1 index 82ae475a..e86fc7f8 100644 --- a/src/functions/public/Repositories/Tags/Remove-GitHubRepositoryTagProtection.ps1 +++ b/src/functions/public/Repositories/Tags/Remove-GitHubRepositoryTagProtection.ps1 @@ -39,8 +39,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT @@ -74,6 +74,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Status/Get-GitHubScheduledMaintenance.ps1 b/src/functions/public/Status/Get-GitHubScheduledMaintenance.ps1 index 4b3a5eda..0afc4e02 100644 --- a/src/functions/public/Status/Get-GitHubScheduledMaintenance.ps1 +++ b/src/functions/public/Status/Get-GitHubScheduledMaintenance.ps1 @@ -50,8 +50,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" } process { @@ -81,6 +81,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Status/Get-GitHubStatus.ps1 b/src/functions/public/Status/Get-GitHubStatus.ps1 index 7baeb675..f8ccb465 100644 --- a/src/functions/public/Status/Get-GitHubStatus.ps1 +++ b/src/functions/public/Status/Get-GitHubStatus.ps1 @@ -39,8 +39,8 @@ [string] $Stamp = 'public' ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" } process { @@ -63,6 +63,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Status/Get-GitHubStatusComponent.ps1 b/src/functions/public/Status/Get-GitHubStatusComponent.ps1 index c142a145..a8a69974 100644 --- a/src/functions/public/Status/Get-GitHubStatusComponent.ps1 +++ b/src/functions/public/Status/Get-GitHubStatusComponent.ps1 @@ -26,8 +26,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" } process { @@ -43,6 +43,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Status/Get-GitHubStatusIncident.ps1 b/src/functions/public/Status/Get-GitHubStatusIncident.ps1 index 472f13b1..8710340b 100644 --- a/src/functions/public/Status/Get-GitHubStatusIncident.ps1 +++ b/src/functions/public/Status/Get-GitHubStatusIncident.ps1 @@ -39,8 +39,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" } process { @@ -63,6 +63,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Teams/Get-GitHubRepoTeam.ps1 b/src/functions/public/Teams/Get-GitHubRepoTeam.ps1 index 78c72b23..74757ed3 100644 --- a/src/functions/public/Teams/Get-GitHubRepoTeam.ps1 +++ b/src/functions/public/Teams/Get-GitHubRepoTeam.ps1 @@ -18,8 +18,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT @@ -51,6 +51,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Teams/Get-GitHubTeamByName.ps1 b/src/functions/public/Teams/Get-GitHubTeamByName.ps1 index 92ef57eb..6d275c72 100644 --- a/src/functions/public/Teams/Get-GitHubTeamByName.ps1 +++ b/src/functions/public/Teams/Get-GitHubTeamByName.ps1 @@ -33,8 +33,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT @@ -61,6 +61,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Teams/Get-GitHubTeamListByOrg.ps1 b/src/functions/public/Teams/Get-GitHubTeamListByOrg.ps1 index b477cea5..40ace7c3 100644 --- a/src/functions/public/Teams/Get-GitHubTeamListByOrg.ps1 +++ b/src/functions/public/Teams/Get-GitHubTeamListByOrg.ps1 @@ -27,8 +27,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT @@ -55,6 +55,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Teams/New-GitHubTeam.ps1 b/src/functions/public/Teams/New-GitHubTeam.ps1 index 24cb3b66..8a14deca 100644 --- a/src/functions/public/Teams/New-GitHubTeam.ps1 +++ b/src/functions/public/Teams/New-GitHubTeam.ps1 @@ -86,8 +86,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT @@ -129,6 +129,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Teams/Remove-GitHubTeam.ps1 b/src/functions/public/Teams/Remove-GitHubTeam.ps1 index 140ff7ef..84a3152f 100644 --- a/src/functions/public/Teams/Remove-GitHubTeam.ps1 +++ b/src/functions/public/Teams/Remove-GitHubTeam.ps1 @@ -33,8 +33,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT @@ -63,6 +63,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Teams/Update-GitHubTeam.ps1 b/src/functions/public/Teams/Update-GitHubTeam.ps1 index 887539b5..79937b1f 100644 --- a/src/functions/public/Teams/Update-GitHubTeam.ps1 +++ b/src/functions/public/Teams/Update-GitHubTeam.ps1 @@ -80,8 +80,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT @@ -121,6 +121,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Users/Blocking/Block-GitHubUser.ps1 b/src/functions/public/Users/Blocking/Block-GitHubUser.ps1 index 16c61383..8a5eb845 100644 --- a/src/functions/public/Users/Blocking/Block-GitHubUser.ps1 +++ b/src/functions/public/Users/Blocking/Block-GitHubUser.ps1 @@ -52,8 +52,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -74,6 +74,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Users/Blocking/Get-GitHubBlockedUser.ps1 b/src/functions/public/Users/Blocking/Get-GitHubBlockedUser.ps1 index bc598058..867d20cf 100644 --- a/src/functions/public/Users/Blocking/Get-GitHubBlockedUser.ps1 +++ b/src/functions/public/Users/Blocking/Get-GitHubBlockedUser.ps1 @@ -45,8 +45,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT @@ -69,6 +69,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Users/Blocking/Test-GitHubBlockedUser.ps1 b/src/functions/public/Users/Blocking/Test-GitHubBlockedUser.ps1 index 09e4d7d3..33df8483 100644 --- a/src/functions/public/Users/Blocking/Test-GitHubBlockedUser.ps1 +++ b/src/functions/public/Users/Blocking/Test-GitHubBlockedUser.ps1 @@ -57,8 +57,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT @@ -81,6 +81,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Users/Blocking/Unblock-GitHubUser.ps1 b/src/functions/public/Users/Blocking/Unblock-GitHubUser.ps1 index bd3826eb..9dcf3504 100644 --- a/src/functions/public/Users/Blocking/Unblock-GitHubUser.ps1 +++ b/src/functions/public/Users/Blocking/Unblock-GitHubUser.ps1 @@ -50,8 +50,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT @@ -74,6 +74,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Users/Emails/Add-GitHubUserEmail.ps1 b/src/functions/public/Users/Emails/Add-GitHubUserEmail.ps1 index 8fc6e8de..04609a71 100644 --- a/src/functions/public/Users/Emails/Add-GitHubUserEmail.ps1 +++ b/src/functions/public/Users/Emails/Add-GitHubUserEmail.ps1 @@ -36,8 +36,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -64,6 +64,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Users/Emails/Get-GitHubUserEmail.ps1 b/src/functions/public/Users/Emails/Get-GitHubUserEmail.ps1 index a8030f74..fa10cebc 100644 --- a/src/functions/public/Users/Emails/Get-GitHubUserEmail.ps1 +++ b/src/functions/public/Users/Emails/Get-GitHubUserEmail.ps1 @@ -42,8 +42,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -61,6 +61,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Users/Emails/Remove-GitHubUserEmail.ps1 b/src/functions/public/Users/Emails/Remove-GitHubUserEmail.ps1 index 29186ed2..c0884175 100644 --- a/src/functions/public/Users/Emails/Remove-GitHubUserEmail.ps1 +++ b/src/functions/public/Users/Emails/Remove-GitHubUserEmail.ps1 @@ -34,8 +34,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -64,6 +64,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Users/Emails/Set-GitHubUserEmailVisibility.ps1 b/src/functions/public/Users/Emails/Set-GitHubUserEmailVisibility.ps1 index c1a66ea8..24a61cc4 100644 --- a/src/functions/public/Users/Emails/Set-GitHubUserEmailVisibility.ps1 +++ b/src/functions/public/Users/Emails/Set-GitHubUserEmailVisibility.ps1 @@ -40,8 +40,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -70,6 +70,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Users/Followers/Add-GitHubUserFollowing.ps1 b/src/functions/public/Users/Followers/Add-GitHubUserFollowing.ps1 index 1df07235..af172ed2 100644 --- a/src/functions/public/Users/Followers/Add-GitHubUserFollowing.ps1 +++ b/src/functions/public/Users/Followers/Add-GitHubUserFollowing.ps1 @@ -36,8 +36,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -59,6 +59,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Users/Followers/Get-GitHubUserFollower.ps1 b/src/functions/public/Users/Followers/Get-GitHubUserFollower.ps1 index 4a65b222..eb2be94b 100644 --- a/src/functions/public/Users/Followers/Get-GitHubUserFollower.ps1 +++ b/src/functions/public/Users/Followers/Get-GitHubUserFollower.ps1 @@ -43,8 +43,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -62,6 +62,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Users/Followers/Get-GitHubUserFollowing.ps1 b/src/functions/public/Users/Followers/Get-GitHubUserFollowing.ps1 index 9e5b4e6f..ba26966f 100644 --- a/src/functions/public/Users/Followers/Get-GitHubUserFollowing.ps1 +++ b/src/functions/public/Users/Followers/Get-GitHubUserFollowing.ps1 @@ -44,8 +44,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -63,6 +63,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Users/Followers/Remove-GitHubUserFollowing.ps1 b/src/functions/public/Users/Followers/Remove-GitHubUserFollowing.ps1 index 7545273a..da2bd615 100644 --- a/src/functions/public/Users/Followers/Remove-GitHubUserFollowing.ps1 +++ b/src/functions/public/Users/Followers/Remove-GitHubUserFollowing.ps1 @@ -33,8 +33,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -58,6 +58,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Users/Followers/Test-GitHubUserFollowing.ps1 b/src/functions/public/Users/Followers/Test-GitHubUserFollowing.ps1 index b015ea40..062ada39 100644 --- a/src/functions/public/Users/Followers/Test-GitHubUserFollowing.ps1 +++ b/src/functions/public/Users/Followers/Test-GitHubUserFollowing.ps1 @@ -50,8 +50,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -69,6 +69,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Users/GPG-Keys/Add-GitHubUserGpgKey.ps1 b/src/functions/public/Users/GPG-Keys/Add-GitHubUserGpgKey.ps1 index 678cf71b..a24cb9b5 100644 --- a/src/functions/public/Users/GPG-Keys/Add-GitHubUserGpgKey.ps1 +++ b/src/functions/public/Users/GPG-Keys/Add-GitHubUserGpgKey.ps1 @@ -49,8 +49,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -78,6 +78,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Users/GPG-Keys/Get-GitHubUserGpgKey.ps1 b/src/functions/public/Users/GPG-Keys/Get-GitHubUserGpgKey.ps1 index 3d5410f0..415e7714 100644 --- a/src/functions/public/Users/GPG-Keys/Get-GitHubUserGpgKey.ps1 +++ b/src/functions/public/Users/GPG-Keys/Get-GitHubUserGpgKey.ps1 @@ -56,8 +56,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -79,6 +79,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Users/GPG-Keys/Remove-GitHubUserGpgKey.ps1 b/src/functions/public/Users/GPG-Keys/Remove-GitHubUserGpgKey.ps1 index ee9ab51a..1f6e7d51 100644 --- a/src/functions/public/Users/GPG-Keys/Remove-GitHubUserGpgKey.ps1 +++ b/src/functions/public/Users/GPG-Keys/Remove-GitHubUserGpgKey.ps1 @@ -34,8 +34,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -59,6 +59,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Users/Get-GitHubUser.ps1 b/src/functions/public/Users/Get-GitHubUser.ps1 index dc6f1195..e72406f4 100644 --- a/src/functions/public/Users/Get-GitHubUser.ps1 +++ b/src/functions/public/Users/Get-GitHubUser.ps1 @@ -65,8 +65,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -96,6 +96,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Users/Get-GitHubUserCard.ps1 b/src/functions/public/Users/Get-GitHubUserCard.ps1 index 0afa2e6c..79ae51fb 100644 --- a/src/functions/public/Users/Get-GitHubUserCard.ps1 +++ b/src/functions/public/Users/Get-GitHubUserCard.ps1 @@ -46,8 +46,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -75,6 +75,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Users/Keys/Add-GitHubUserKey.ps1 b/src/functions/public/Users/Keys/Add-GitHubUserKey.ps1 index 1713495a..dcd9b37f 100644 --- a/src/functions/public/Users/Keys/Add-GitHubUserKey.ps1 +++ b/src/functions/public/Users/Keys/Add-GitHubUserKey.ps1 @@ -43,8 +43,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -72,6 +72,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Users/Keys/Get-GitHubUserKey.ps1 b/src/functions/public/Users/Keys/Get-GitHubUserKey.ps1 index 05a4fa0f..04dd5f42 100644 --- a/src/functions/public/Users/Keys/Get-GitHubUserKey.ps1 +++ b/src/functions/public/Users/Keys/Get-GitHubUserKey.ps1 @@ -59,8 +59,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -82,6 +82,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Users/Keys/Remove-GitHubUserKey.ps1 b/src/functions/public/Users/Keys/Remove-GitHubUserKey.ps1 index 54491231..6870fcfe 100644 --- a/src/functions/public/Users/Keys/Remove-GitHubUserKey.ps1 +++ b/src/functions/public/Users/Keys/Remove-GitHubUserKey.ps1 @@ -35,8 +35,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -60,6 +60,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Users/SSH-Signing-Keys/Add-GitHubUserSigningKey.ps1 b/src/functions/public/Users/SSH-Signing-Keys/Add-GitHubUserSigningKey.ps1 index 5857a722..13815ab3 100644 --- a/src/functions/public/Users/SSH-Signing-Keys/Add-GitHubUserSigningKey.ps1 +++ b/src/functions/public/Users/SSH-Signing-Keys/Add-GitHubUserSigningKey.ps1 @@ -45,8 +45,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -74,6 +74,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Users/SSH-Signing-Keys/Get-GitHubUserSigningKey.ps1 b/src/functions/public/Users/SSH-Signing-Keys/Get-GitHubUserSigningKey.ps1 index 1e9c47b4..cc1fd255 100644 --- a/src/functions/public/Users/SSH-Signing-Keys/Get-GitHubUserSigningKey.ps1 +++ b/src/functions/public/Users/SSH-Signing-Keys/Get-GitHubUserSigningKey.ps1 @@ -59,8 +59,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -82,6 +82,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Users/SSH-Signing-Keys/Remove-GitHubUserSigningKey.ps1 b/src/functions/public/Users/SSH-Signing-Keys/Remove-GitHubUserSigningKey.ps1 index a2c60221..af4aab7b 100644 --- a/src/functions/public/Users/SSH-Signing-Keys/Remove-GitHubUserSigningKey.ps1 +++ b/src/functions/public/Users/SSH-Signing-Keys/Remove-GitHubUserSigningKey.ps1 @@ -36,8 +36,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -61,6 +61,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Users/Set-GitHubUser.ps1 b/src/functions/public/Users/Set-GitHubUser.ps1 index 089265a5..b7c23432 100644 --- a/src/functions/public/Users/Set-GitHubUser.ps1 +++ b/src/functions/public/Users/Set-GitHubUser.ps1 @@ -69,8 +69,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -106,6 +106,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Users/Social-Accounts/Add-GitHubUserSocial.ps1 b/src/functions/public/Users/Social-Accounts/Add-GitHubUserSocial.ps1 index e75699b9..ebafaa78 100644 --- a/src/functions/public/Users/Social-Accounts/Add-GitHubUserSocial.ps1 +++ b/src/functions/public/Users/Social-Accounts/Add-GitHubUserSocial.ps1 @@ -31,8 +31,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -59,6 +59,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Users/Social-Accounts/Remove-GitHubUserSocial.ps1 b/src/functions/public/Users/Social-Accounts/Remove-GitHubUserSocial.ps1 index 9f5f6172..48bea649 100644 --- a/src/functions/public/Users/Social-Accounts/Remove-GitHubUserSocial.ps1 +++ b/src/functions/public/Users/Social-Accounts/Remove-GitHubUserSocial.ps1 @@ -32,8 +32,8 @@ ) begin { - $commandName = $MyInvocation.MyCommand.Name - Write-Debug "[$commandName] - Start" + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" $Context = Resolve-GitHubContext -Context $Context Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } @@ -62,6 +62,6 @@ } end { - Write-Debug "[$commandName] - End" + Write-Debug "[$stackPath] - End" } } From 8bea30106ed273f83b0ea4a7207890fc5d5e7cb6 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sun, 15 Dec 2024 21:43:10 +0100 Subject: [PATCH 13/24] Fix --- .../private/Utilities/PowerShell/Get-PSCallStackPath.ps1 | 1 + 1 file changed, 1 insertion(+) diff --git a/src/functions/private/Utilities/PowerShell/Get-PSCallStackPath.ps1 b/src/functions/private/Utilities/PowerShell/Get-PSCallStackPath.ps1 index 6a0ad886..b1157ec0 100644 --- a/src/functions/private/Utilities/PowerShell/Get-PSCallStackPath.ps1 +++ b/src/functions/private/Utilities/PowerShell/Get-PSCallStackPath.ps1 @@ -42,5 +42,6 @@ $skipFirst++ $cmds = (Get-PSCallStack).Command $functionPath = $cmds[($cmds.Count - $skipFirst)..$SkipLatest] -join '\' + $functionPath = $functionPath -replace '^.*' return $functionPath } From 639183d9308ce6aa472776152ea01baabe72dc2b Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sun, 15 Dec 2024 22:05:08 +0100 Subject: [PATCH 14/24] Enhance Get-PSCallStackPath function to refine script block path extraction --- .../private/Utilities/PowerShell/Get-PSCallStackPath.ps1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/functions/private/Utilities/PowerShell/Get-PSCallStackPath.ps1 b/src/functions/private/Utilities/PowerShell/Get-PSCallStackPath.ps1 index b1157ec0..ab2b3e97 100644 --- a/src/functions/private/Utilities/PowerShell/Get-PSCallStackPath.ps1 +++ b/src/functions/private/Utilities/PowerShell/Get-PSCallStackPath.ps1 @@ -42,6 +42,7 @@ $skipFirst++ $cmds = (Get-PSCallStack).Command $functionPath = $cmds[($cmds.Count - $skipFirst)..$SkipLatest] -join '\' - $functionPath = $functionPath -replace '^.*' + $functionPath = $functionPath -replace '^.*\\' + $functionPath = $functionPath -replace '^.*.ps1\\' return $functionPath } From b876adf53e7efd99c34a51530c586d0f5d34bbdb Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sun, 15 Dec 2024 22:05:10 +0100 Subject: [PATCH 15/24] Refactor parameter assignment in Get-GitHubRepository function for improved clarity and consistency --- .../Repositories/Get-GitHubRepository.ps1 | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/functions/public/Repositories/Repositories/Get-GitHubRepository.ps1 b/src/functions/public/Repositories/Repositories/Get-GitHubRepository.ps1 index 40ef7a5d..8e7e1891 100644 --- a/src/functions/public/Repositories/Repositories/Get-GitHubRepository.ps1 +++ b/src/functions/public/Repositories/Repositories/Get-GitHubRepository.ps1 @@ -180,12 +180,10 @@ filter Get-GitHubRepository { process { try { - $params = @{ - Context = $Context - } switch ($PSCmdlet.ParameterSetName) { 'MyRepos_Type' { - $params += @{ + $params = @{ + Context = $Context Type = $Type Sort = $Sort Direction = $Direction @@ -196,7 +194,8 @@ filter Get-GitHubRepository { Get-GitHubMyRepositories @params } 'MyRepos_Aff-Vis' { - $params += @{ + $params = @{ + Context = $Context Visibility = $Visibility Affiliation = $Affiliation Sort = $Sort @@ -208,20 +207,23 @@ filter Get-GitHubRepository { Get-GitHubMyRepositories @params } 'ByName' { - $params += @{ - Owner = $Owner - Repo = $Repo + $params = @{ + Context = $Context + Owner = $Owner + Repo = $Repo } Get-GitHubRepositoryByName @params } 'ListByID' { - $params += @{ - Since = $SinceID + $params = @{ + Context = $Context + Since = $SinceID } Get-GitHubRepositoryListByID @params } 'ListByOrg' { - $params += @{ + $params = @{ + Context = $Context Owner = $Owner Type = $Type Sort = $Sort @@ -231,7 +233,8 @@ filter Get-GitHubRepository { Get-GitHubRepositoryListByOrg @params } 'ListByUser' { - $params += @{ + $params = @{ + Context = $Context Username = $Username Type = $Type Sort = $Sort From 3a0d36fe6082f0a71a9cf918f3e67eacc98bd8bc Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sun, 15 Dec 2024 22:57:49 +0100 Subject: [PATCH 16/24] Update required module version to 5.0.4 in GitHub context functions for consistency --- src/functions/private/Auth/Context/Remove-GitHubContext.ps1 | 2 +- src/functions/private/Auth/Context/Set-GitHubContext.ps1 | 2 +- src/functions/public/Auth/Context/Get-GitHubContext.ps1 | 2 +- src/functions/public/Config/Get-GitHubConfig.ps1 | 2 +- src/functions/public/Config/Remove-GitHubConfig.ps1 | 2 +- src/functions/public/Config/Set-GitHubConfig.ps1 | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/functions/private/Auth/Context/Remove-GitHubContext.ps1 b/src/functions/private/Auth/Context/Remove-GitHubContext.ps1 index 74aaaae3..72b5b424 100644 --- a/src/functions/private/Auth/Context/Remove-GitHubContext.ps1 +++ b/src/functions/private/Auth/Context/Remove-GitHubContext.ps1 @@ -1,4 +1,4 @@ -#Requires -Modules @{ ModuleName = 'Context'; RequiredVersion = '5.0.3' } +#Requires -Modules @{ ModuleName = 'Context'; RequiredVersion = '5.0.4' } filter Remove-GitHubContext { <# diff --git a/src/functions/private/Auth/Context/Set-GitHubContext.ps1 b/src/functions/private/Auth/Context/Set-GitHubContext.ps1 index 716ca18e..902f7604 100644 --- a/src/functions/private/Auth/Context/Set-GitHubContext.ps1 +++ b/src/functions/private/Auth/Context/Set-GitHubContext.ps1 @@ -1,4 +1,4 @@ -#Requires -Modules @{ ModuleName = 'Context'; RequiredVersion = '5.0.3' } +#Requires -Modules @{ ModuleName = 'Context'; RequiredVersion = '5.0.4' } function Set-GitHubContext { <# diff --git a/src/functions/public/Auth/Context/Get-GitHubContext.ps1 b/src/functions/public/Auth/Context/Get-GitHubContext.ps1 index cac9e23b..f14da0dd 100644 --- a/src/functions/public/Auth/Context/Get-GitHubContext.ps1 +++ b/src/functions/public/Auth/Context/Get-GitHubContext.ps1 @@ -1,4 +1,4 @@ -#Requires -Modules @{ ModuleName = 'Context'; RequiredVersion = '5.0.3' } +#Requires -Modules @{ ModuleName = 'Context'; RequiredVersion = '5.0.4' } function Get-GitHubContext { <# diff --git a/src/functions/public/Config/Get-GitHubConfig.ps1 b/src/functions/public/Config/Get-GitHubConfig.ps1 index 81a02784..80ad7190 100644 --- a/src/functions/public/Config/Get-GitHubConfig.ps1 +++ b/src/functions/public/Config/Get-GitHubConfig.ps1 @@ -1,4 +1,4 @@ -#Requires -Modules @{ ModuleName = 'Context'; RequiredVersion = '5.0.3' } +#Requires -Modules @{ ModuleName = 'Context'; RequiredVersion = '5.0.4' } function Get-GitHubConfig { <# diff --git a/src/functions/public/Config/Remove-GitHubConfig.ps1 b/src/functions/public/Config/Remove-GitHubConfig.ps1 index a9bd256c..fc882ed6 100644 --- a/src/functions/public/Config/Remove-GitHubConfig.ps1 +++ b/src/functions/public/Config/Remove-GitHubConfig.ps1 @@ -1,4 +1,4 @@ -#Requires -Modules @{ ModuleName = 'Context'; RequiredVersion = '5.0.3' } +#Requires -Modules @{ ModuleName = 'Context'; RequiredVersion = '5.0.4' } function Remove-GitHubConfig { <# diff --git a/src/functions/public/Config/Set-GitHubConfig.ps1 b/src/functions/public/Config/Set-GitHubConfig.ps1 index a1bec6c8..feebfc01 100644 --- a/src/functions/public/Config/Set-GitHubConfig.ps1 +++ b/src/functions/public/Config/Set-GitHubConfig.ps1 @@ -1,4 +1,4 @@ -#Requires -Modules @{ ModuleName = 'Context'; RequiredVersion = '5.0.3' } +#Requires -Modules @{ ModuleName = 'Context'; RequiredVersion = '5.0.4' } function Set-GitHubConfig { <# From 3ab340e52590cb5954dbf4885da29cee5999d77a Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sun, 15 Dec 2024 23:21:28 +0100 Subject: [PATCH 17/24] Test --- .../Repositories/Repositories/Get-GitHubRepository.ps1 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/functions/public/Repositories/Repositories/Get-GitHubRepository.ps1 b/src/functions/public/Repositories/Repositories/Get-GitHubRepository.ps1 index 8e7e1891..6d15f18b 100644 --- a/src/functions/public/Repositories/Repositories/Get-GitHubRepository.ps1 +++ b/src/functions/public/Repositories/Repositories/Get-GitHubRepository.ps1 @@ -180,6 +180,7 @@ filter Get-GitHubRepository { process { try { + Write-Verbose "ParamSet: [$($PSCmdlet.ParameterSetName)]" switch ($PSCmdlet.ParameterSetName) { 'MyRepos_Type' { $params = @{ @@ -191,6 +192,7 @@ filter Get-GitHubRepository { Since = $Since Before = $Before } + $params | Format-Table -AutoSize | Out-String | ForEach-Object { Write-Debug $_ } Get-GitHubMyRepositories @params } 'MyRepos_Aff-Vis' { @@ -204,6 +206,7 @@ filter Get-GitHubRepository { Since = $Since Before = $Before } + $params | Format-Table -AutoSize | Out-String | ForEach-Object { Write-Debug $_ } Get-GitHubMyRepositories @params } 'ByName' { @@ -212,6 +215,7 @@ filter Get-GitHubRepository { Owner = $Owner Repo = $Repo } + $params | Format-Table -AutoSize | Out-String | ForEach-Object { Write-Debug $_ } Get-GitHubRepositoryByName @params } 'ListByID' { @@ -219,6 +223,7 @@ filter Get-GitHubRepository { Context = $Context Since = $SinceID } + $params | Format-Table -AutoSize | Out-String | ForEach-Object { Write-Debug $_ } Get-GitHubRepositoryListByID @params } 'ListByOrg' { @@ -230,6 +235,7 @@ filter Get-GitHubRepository { Direction = $Direction PerPage = $PerPage } + $params | Format-Table -AutoSize | Out-String | ForEach-Object { Write-Debug $_ } Get-GitHubRepositoryListByOrg @params } 'ListByUser' { @@ -241,6 +247,7 @@ filter Get-GitHubRepository { Direction = $Direction PerPage = $PerPage } + $params | Format-Table -AutoSize | Out-String | ForEach-Object { Write-Debug $_ } Get-GitHubRepositoryListByUser @params } } From ec454f1537f5792b7b9f86a93ec5c6f28281319c Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sun, 15 Dec 2024 23:54:01 +0100 Subject: [PATCH 18/24] Add parameter assignment for Type in Get-GitHubRepository function --- .../public/Repositories/Repositories/Get-GitHubRepository.ps1 | 1 + 1 file changed, 1 insertion(+) diff --git a/src/functions/public/Repositories/Repositories/Get-GitHubRepository.ps1 b/src/functions/public/Repositories/Repositories/Get-GitHubRepository.ps1 index 6d15f18b..6798e63e 100644 --- a/src/functions/public/Repositories/Repositories/Get-GitHubRepository.ps1 +++ b/src/functions/public/Repositories/Repositories/Get-GitHubRepository.ps1 @@ -180,6 +180,7 @@ filter Get-GitHubRepository { process { try { + $Type = $PSBoundParameters['Type'] Write-Verbose "ParamSet: [$($PSCmdlet.ParameterSetName)]" switch ($PSCmdlet.ParameterSetName) { 'MyRepos_Type' { From ad4a1102d2b1f37d9d423643b61b0209616e2642 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Mon, 16 Dec 2024 00:14:06 +0100 Subject: [PATCH 19/24] Set default value for Direction parameter in Get-GitHubRepository function --- .../public/Repositories/Repositories/Get-GitHubRepository.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/functions/public/Repositories/Repositories/Get-GitHubRepository.ps1 b/src/functions/public/Repositories/Repositories/Get-GitHubRepository.ps1 index 6798e63e..789a647a 100644 --- a/src/functions/public/Repositories/Repositories/Get-GitHubRepository.ps1 +++ b/src/functions/public/Repositories/Repositories/Get-GitHubRepository.ps1 @@ -115,7 +115,7 @@ filter Get-GitHubRepository { [Parameter(ParameterSetName = 'ListByOrg')] [Parameter(ParameterSetName = 'ListByUser')] [ValidateSet('asc', 'desc')] - [string] $Direction, + [string] $Direction = 'asc', # The number of results per page (max 100). [Parameter(ParameterSetName = 'MyRepos')] From 613c5a8165778112bf05d966a022bff003c7e065 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Mon, 16 Dec 2024 00:35:56 +0100 Subject: [PATCH 20/24] Remove null or empty values from parameters in Get-GitHubRepository function --- .../Repositories/Get-GitHubRepository.ps1 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/functions/public/Repositories/Repositories/Get-GitHubRepository.ps1 b/src/functions/public/Repositories/Repositories/Get-GitHubRepository.ps1 index 789a647a..01def1b5 100644 --- a/src/functions/public/Repositories/Repositories/Get-GitHubRepository.ps1 +++ b/src/functions/public/Repositories/Repositories/Get-GitHubRepository.ps1 @@ -192,7 +192,7 @@ filter Get-GitHubRepository { PerPage = $PerPage Since = $Since Before = $Before - } + } | Remove-HashtableEntry -NullOrEmptyValues $params | Format-Table -AutoSize | Out-String | ForEach-Object { Write-Debug $_ } Get-GitHubMyRepositories @params } @@ -206,7 +206,7 @@ filter Get-GitHubRepository { PerPage = $PerPage Since = $Since Before = $Before - } + } | Remove-HashtableEntry -NullOrEmptyValues $params | Format-Table -AutoSize | Out-String | ForEach-Object { Write-Debug $_ } Get-GitHubMyRepositories @params } @@ -215,7 +215,7 @@ filter Get-GitHubRepository { Context = $Context Owner = $Owner Repo = $Repo - } + } | Remove-HashtableEntry -NullOrEmptyValues $params | Format-Table -AutoSize | Out-String | ForEach-Object { Write-Debug $_ } Get-GitHubRepositoryByName @params } @@ -223,7 +223,7 @@ filter Get-GitHubRepository { $params = @{ Context = $Context Since = $SinceID - } + } | Remove-HashtableEntry -NullOrEmptyValues $params | Format-Table -AutoSize | Out-String | ForEach-Object { Write-Debug $_ } Get-GitHubRepositoryListByID @params } @@ -235,7 +235,7 @@ filter Get-GitHubRepository { Sort = $Sort Direction = $Direction PerPage = $PerPage - } + } | Remove-HashtableEntry -NullOrEmptyValues $params | Format-Table -AutoSize | Out-String | ForEach-Object { Write-Debug $_ } Get-GitHubRepositoryListByOrg @params } @@ -247,7 +247,7 @@ filter Get-GitHubRepository { Sort = $Sort Direction = $Direction PerPage = $PerPage - } + } | Remove-HashtableEntry -NullOrEmptyValues $params | Format-Table -AutoSize | Out-String | ForEach-Object { Write-Debug $_ } Get-GitHubRepositoryListByUser @params } From 44490061550e939765e108ecaf4f163e90c9775c Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Mon, 16 Dec 2024 01:00:07 +0100 Subject: [PATCH 21/24] More debugging --- .../Hashtable/ConvertFrom-HashTable.ps1 | 18 ++++- .../Hashtable/ConvertTo-HashTable.ps1 | 25 ++++-- .../Utilities/Hashtable/Join-Object.ps1 | 42 ++++++---- .../Hashtable/Remove-HashtableEntry.ps1 | 77 +++++++++++-------- .../Repositories/Get-GitHubRepository.ps1 | 14 ++-- 5 files changed, 119 insertions(+), 57 deletions(-) diff --git a/src/functions/private/Utilities/Hashtable/ConvertFrom-HashTable.ps1 b/src/functions/private/Utilities/Hashtable/ConvertFrom-HashTable.ps1 index 38968847..0827535c 100644 --- a/src/functions/private/Utilities/Hashtable/ConvertFrom-HashTable.ps1 +++ b/src/functions/private/Utilities/Hashtable/ConvertFrom-HashTable.ps1 @@ -41,5 +41,21 @@ [AllowNull()] [object] $InputObject ) - $InputObject | ConvertTo-Json -Depth 100 | ConvertFrom-Json + + begin { + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" + } + + process { + try { + $InputObject | ConvertTo-Json -Depth 100 | ConvertFrom-Json + } catch { + throw $_ + } + } + + end { + Write-Debug "[$stackPath] - End" + } } diff --git a/src/functions/private/Utilities/Hashtable/ConvertTo-HashTable.ps1 b/src/functions/private/Utilities/Hashtable/ConvertTo-HashTable.ps1 index 8b5e71f4..edcfa481 100644 --- a/src/functions/private/Utilities/Hashtable/ConvertTo-HashTable.ps1 +++ b/src/functions/private/Utilities/Hashtable/ConvertTo-HashTable.ps1 @@ -57,11 +57,26 @@ )] [string]$NameCasingStyle ) - [hashtable]$hashtable = @{} - foreach ($item in $InputObject.PSObject.Properties) { - $name = if ($NameCasingStyle) { ($item.Name | Convert-StringCasingStyle -To $NameCasingStyle) } else { $item.Name } - $hashtable[$name] = $item.Value + begin { + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" + [hashtable]$hashtable = @{} + } + + process { + try { + foreach ($item in $InputObject.PSObject.Properties) { + $name = if ($NameCasingStyle) { ($item.Name | Convert-StringCasingStyle -To $NameCasingStyle) } else { $item.Name } + $hashtable[$name] = $item.Value + } + $hashtable + } catch { + throw $_ + } + } + + end { + Write-Debug "[$stackPath] - End" } - $hashtable } diff --git a/src/functions/private/Utilities/Hashtable/Join-Object.ps1 b/src/functions/private/Utilities/Hashtable/Join-Object.ps1 index 18306e04..3e90ae27 100644 --- a/src/functions/private/Utilities/Hashtable/Join-Object.ps1 +++ b/src/functions/private/Utilities/Hashtable/Join-Object.ps1 @@ -73,24 +73,40 @@ [switch] $AsHashtable ) - if ($Main -isnot [hashtable]) { - $Main = $Main | ConvertTo-HashTable + begin { + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" } - $hashtable = $Main.clone() - foreach ($Override in $Overrides) { - if ($Override -isnot [hashtable]) { - $Override = $Override | ConvertTo-HashTable - } + process { + try { + + if ($Main -isnot [hashtable]) { + $Main = $Main | ConvertTo-HashTable + } + $hashtable = $Main.clone() + + foreach ($Override in $Overrides) { + if ($Override -isnot [hashtable]) { + $Override = $Override | ConvertTo-HashTable + } - $Override.Keys | ForEach-Object { - $hashtable[$_] = $Override[$_] + $Override.Keys | ForEach-Object { + $hashtable[$_] = $Override[$_] + } + } + + if ($AsHashtable) { + return $hashtable + } + + $hashtable | ConvertFrom-HashTable + } catch { + throw $_ } } - if ($AsHashtable) { - return $hashtable + end { + Write-Debug "[$stackPath] - End" } - - $hashtable | ConvertFrom-HashTable } diff --git a/src/functions/private/Utilities/Hashtable/Remove-HashtableEntry.ps1 b/src/functions/private/Utilities/Hashtable/Remove-HashtableEntry.ps1 index fc37c769..9b8e1c6d 100644 --- a/src/functions/private/Utilities/Hashtable/Remove-HashtableEntry.ps1 +++ b/src/functions/private/Utilities/Hashtable/Remove-HashtableEntry.ps1 @@ -54,39 +54,54 @@ [string[]] $KeepNames ) - if ($NullOrEmptyValues) { - Write-Debug 'Remove keys with null or empty values' - ($Hashtable.GetEnumerator() | Where-Object { [string]::IsNullOrEmpty($_.Value) }) | ForEach-Object { - Write-Debug " - [$($_.Name)] - Value: [$($_.Value)] - Remove" - $Hashtable.Remove($_.Name) - } - } - if ($RemoveTypes) { - Write-Debug "Remove keys of type: [$RemoveTypes]" - ($Hashtable.GetEnumerator() | Where-Object { ($_.Value.GetType().Name -in $RemoveTypes) }) | ForEach-Object { - Write-Debug " - [$($_.Name)] - Type: [$($_.Value.GetType().Name)] - Remove" - $Hashtable.Remove($_.Name) - } - } - if ($KeepTypes) { - Write-Debug "Remove keys NOT of type: [$KeepTypes]" - ($Hashtable.GetEnumerator() | Where-Object { ($_.Value.GetType().Name -notin $KeepTypes) }) | ForEach-Object { - Write-Debug " - [$($_.Name)] - Type: [$($_.Value.GetType().Name)] - Remove" - $Hashtable.Remove($_.Name) - } + begin { + $stackPath = Get-PSCallStackPath + Write-Debug "[$stackPath] - Start" } - if ($RemoveNames) { - Write-Debug "Remove keys named: [$RemoveNames]" - ($Hashtable.GetEnumerator() | Where-Object { $_.Name -in $RemoveNames }) | ForEach-Object { - Write-Debug " - [$($_.Name)] - Remove" - $Hashtable.Remove($_.Name) + + process { + try { + if ($NullOrEmptyValues) { + Write-Debug 'Remove keys with null or empty values' + ($Hashtable.GetEnumerator() | Where-Object { [string]::IsNullOrEmpty($_.Value) }) | ForEach-Object { + Write-Debug " - [$($_.Name)] - Value: [$($_.Value)] - Remove" + $Hashtable.Remove($_.Name) + } + } + if ($RemoveTypes) { + Write-Debug "Remove keys of type: [$RemoveTypes]" + ($Hashtable.GetEnumerator() | Where-Object { ($_.Value.GetType().Name -in $RemoveTypes) }) | ForEach-Object { + Write-Debug " - [$($_.Name)] - Type: [$($_.Value.GetType().Name)] - Remove" + $Hashtable.Remove($_.Name) + } + } + if ($KeepTypes) { + Write-Debug "Remove keys NOT of type: [$KeepTypes]" + ($Hashtable.GetEnumerator() | Where-Object { ($_.Value.GetType().Name -notin $KeepTypes) }) | ForEach-Object { + Write-Debug " - [$($_.Name)] - Type: [$($_.Value.GetType().Name)] - Remove" + $Hashtable.Remove($_.Name) + } + } + if ($RemoveNames) { + Write-Debug "Remove keys named: [$RemoveNames]" + ($Hashtable.GetEnumerator() | Where-Object { $_.Name -in $RemoveNames }) | ForEach-Object { + Write-Debug " - [$($_.Name)] - Remove" + $Hashtable.Remove($_.Name) + } + } + if ($KeepNames) { + Write-Debug "Remove keys NOT named: [$KeepNames]" + ($Hashtable.GetEnumerator() | Where-Object { $_.Name -notin $KeepNames }) | ForEach-Object { + Write-Debug " - [$($_.Name)] - Remove" + $Hashtable.Remove($_.Name) + } + } + } catch { + throw $_ } } - if ($KeepNames) { - Write-Debug "Remove keys NOT named: [$KeepNames]" - ($Hashtable.GetEnumerator() | Where-Object { $_.Name -notin $KeepNames }) | ForEach-Object { - Write-Debug " - [$($_.Name)] - Remove" - $Hashtable.Remove($_.Name) - } + + end { + Write-Debug "[$stackPath] - End" } } diff --git a/src/functions/public/Repositories/Repositories/Get-GitHubRepository.ps1 b/src/functions/public/Repositories/Repositories/Get-GitHubRepository.ps1 index 01def1b5..8c73b31c 100644 --- a/src/functions/public/Repositories/Repositories/Get-GitHubRepository.ps1 +++ b/src/functions/public/Repositories/Repositories/Get-GitHubRepository.ps1 @@ -181,7 +181,7 @@ filter Get-GitHubRepository { process { try { $Type = $PSBoundParameters['Type'] - Write-Verbose "ParamSet: [$($PSCmdlet.ParameterSetName)]" + Write-Debug "ParamSet: [$($PSCmdlet.ParameterSetName)]" switch ($PSCmdlet.ParameterSetName) { 'MyRepos_Type' { $params = @{ @@ -193,7 +193,7 @@ filter Get-GitHubRepository { Since = $Since Before = $Before } | Remove-HashtableEntry -NullOrEmptyValues - $params | Format-Table -AutoSize | Out-String | ForEach-Object { Write-Debug $_ } + $params | Format-Table -AutoSize | Out-String -Stream | ForEach-Object { Write-Debug $_ } Get-GitHubMyRepositories @params } 'MyRepos_Aff-Vis' { @@ -207,7 +207,7 @@ filter Get-GitHubRepository { Since = $Since Before = $Before } | Remove-HashtableEntry -NullOrEmptyValues - $params | Format-Table -AutoSize | Out-String | ForEach-Object { Write-Debug $_ } + $params | Format-Table -AutoSize | Out-String -Stream | ForEach-Object { Write-Debug $_ } Get-GitHubMyRepositories @params } 'ByName' { @@ -216,7 +216,7 @@ filter Get-GitHubRepository { Owner = $Owner Repo = $Repo } | Remove-HashtableEntry -NullOrEmptyValues - $params | Format-Table -AutoSize | Out-String | ForEach-Object { Write-Debug $_ } + $params | Format-Table -AutoSize | Out-String -Stream | ForEach-Object { Write-Debug $_ } Get-GitHubRepositoryByName @params } 'ListByID' { @@ -224,7 +224,7 @@ filter Get-GitHubRepository { Context = $Context Since = $SinceID } | Remove-HashtableEntry -NullOrEmptyValues - $params | Format-Table -AutoSize | Out-String | ForEach-Object { Write-Debug $_ } + $params | Format-Table -AutoSize | Out-String -Stream | ForEach-Object { Write-Debug $_ } Get-GitHubRepositoryListByID @params } 'ListByOrg' { @@ -236,7 +236,7 @@ filter Get-GitHubRepository { Direction = $Direction PerPage = $PerPage } | Remove-HashtableEntry -NullOrEmptyValues - $params | Format-Table -AutoSize | Out-String | ForEach-Object { Write-Debug $_ } + $params | Format-Table -AutoSize | Out-String -Stream | ForEach-Object { Write-Debug $_ } Get-GitHubRepositoryListByOrg @params } 'ListByUser' { @@ -248,7 +248,7 @@ filter Get-GitHubRepository { Direction = $Direction PerPage = $PerPage } | Remove-HashtableEntry -NullOrEmptyValues - $params | Format-Table -AutoSize | Out-String | ForEach-Object { Write-Debug $_ } + $params | Format-Table -AutoSize | Out-String -Stream | ForEach-Object { Write-Debug $_ } Get-GitHubRepositoryListByUser @params } } From f3acef5a768875c530db8f48109924bdf5a43db2 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Mon, 16 Dec 2024 01:27:25 +0100 Subject: [PATCH 22/24] Refactor debug output to improve readability by removing extra spaces in organization and owner messages --- .../private/Actions/Get-GitHubWorkflowRunByRepo.ps1 | 4 ++-- .../Actions/Get-GitHubWorkflowRunByWorkflow.ps1 | 4 ++-- .../private/License/Get-GitHubRepositoryLicense.ps1 | 4 ++-- .../Releases/Assets/Get-GitHubReleaseAssetByID.ps1 | 4 ++-- .../Assets/Get-GitHubReleaseAssetByReleaseID.ps1 | 4 ++-- .../private/Releases/Releases/Get-GitHubReleaseAll.ps1 | 4 ++-- .../Releases/Releases/Get-GitHubReleaseByID.ps1 | 4 ++-- .../Releases/Releases/Get-GitHubReleaseByTagName.ps1 | 4 ++-- .../Releases/Releases/Get-GitHubReleaseLatest.ps1 | 4 ++-- .../Autolinks/Get-GitHubRepositoryAutolinkById.ps1 | 4 ++-- .../Autolinks/Get-GitHubRepositoryAutolinkList.ps1 | 4 ++-- .../Repositories/Fork/New-GitHubRepositoryAsFork.ps1 | 6 +++--- .../Repositories/Get-GitHubRepositoryByName.ps1 | 4 ++-- .../Repositories/Get-GitHubRepositoryListByOrg.ps1 | 2 +- .../Repositories/Get-GitHubRepositoryListByUser.ps1 | 4 ++-- .../Repositories/New-GitHubRepositoryFromTemplate.ps1 | 2 +- .../Repositories/New-GitHubRepositoryOrg.ps1 | 2 +- src/functions/public/API/Invoke-GitHubAPI.ps1 | 4 ++-- .../public/Actions/Disable-GitHubWorkflow.ps1 | 4 ++-- src/functions/public/Actions/Enable-GitHubWorkflow.ps1 | 4 ++-- src/functions/public/Actions/Get-GitHubWorkflow.ps1 | 4 ++-- src/functions/public/Actions/Get-GitHubWorkflowRun.ps1 | 4 ++-- .../public/Actions/Get-GitHubWorkflowUsage.ps1 | 4 ++-- .../public/Actions/Remove-GitHubWorkflowRun.ps1 | 4 ++-- src/functions/public/Actions/Start-GitHubWorkflow.ps1 | 4 ++-- .../public/Actions/Start-GitHubWorkflowReRun.ps1 | 4 ++-- .../public/Actions/Stop-GitHubWorkflowRun.ps1 | 4 ++-- .../public/Apps/GitHub Apps/Get-GitHubApp.ps1 | 4 ++-- src/functions/public/Branches/Get-GitHubRepoBranch.ps1 | 4 ++-- .../Get-GitHubEnterpriseInstallableOrganization.ps1 | 2 +- .../Enterprise/Get-GitHubEnterpriseOrganization.ps1 | 2 +- .../Install-GitHubAppOnEnterpriseOrganization.ps1 | 2 +- src/functions/public/Gitignore/Get-GitHubGitignore.ps1 | 2 +- src/functions/public/License/Get-GitHubLicense.ps1 | 4 ++-- .../public/Organization/Get-GitHubOrganization.ps1 | 2 +- .../Get-GitHubOrganizationAppInstallation.ps1 | 2 +- .../Members/Get-GitHubOrganizationMember.ps1 | 2 +- .../Get-GitHubOrganizationPendingInvitation.ps1 | 2 +- .../Members/New-GitHubOrganizationInvitation.ps1 | 2 +- .../public/Organization/Remove-GitHubOrganization.ps1 | 2 +- .../public/Organization/Set-GitHubOrganization.ps1 | 2 +- .../Set-GitHubOrganizationSecurityFeature.ps1 | 2 +- .../public/Releases/Assets/Add-GitHubReleaseAsset.ps1 | 4 ++-- .../public/Releases/Assets/Get-GitHubReleaseAsset.ps1 | 4 ++-- .../Releases/Assets/Remove-GitHubReleaseAsset.ps1 | 4 ++-- .../public/Releases/Assets/Set-GitHubReleaseAsset.ps1 | 4 ++-- .../public/Releases/Releases/Get-GitHubRelease.ps1 | 4 ++-- .../public/Releases/Releases/New-GitHubRelease.ps1 | 4 ++-- .../public/Releases/Releases/New-GitHubReleaseNote.ps1 | 4 ++-- .../public/Releases/Releases/Remove-GitHubRelease.ps1 | 4 ++-- .../public/Releases/Releases/Set-GitHubRelease.ps1 | 4 ++-- .../Autolinks/Get-GitHubRepositoryAutolink.ps1 | 4 ++-- .../Autolinks/New-GitHubRepositoryAutolink.ps1 | 4 ++-- .../Autolinks/Remove-GitHubRepositoryAutolink.ps1 | 4 ++-- .../Get-GitHubRepositoryCustomProperty.ps1 | 4 ++-- ...e-GitHubRepositoryPrivateVulnerabilityReporting.ps1 | 4 ++-- .../Disable-GitHubRepositorySecurityFix.ps1 | 4 ++-- .../Disable-GitHubRepositoryVulnerabilityAlert.ps1 | 4 ++-- ...e-GitHubRepositoryPrivateVulnerabilityReporting.ps1 | 4 ++-- .../Enable-GitHubRepositorySecurityFix.ps1 | 4 ++-- .../Enable-GitHubRepositoryVulnerabilityAlert.ps1 | 4 ++-- .../Repositories/Repositories/Get-GitHubRepository.ps1 | 10 ++-------- .../Repositories/Get-GitHubRepositoryActivity.ps1 | 4 ++-- .../Get-GitHubRepositoryCodeownersError.ps1 | 4 ++-- .../Repositories/Get-GitHubRepositoryContributor.ps1 | 4 ++-- .../Repositories/Get-GitHubRepositoryFork.ps1 | 4 ++-- .../Repositories/Get-GitHubRepositoryLanguage.ps1 | 4 ++-- .../Repositories/Get-GitHubRepositorySecurityFix.ps1 | 4 ++-- .../Repositories/Get-GitHubRepositoryTag.ps1 | 4 ++-- .../Repositories/Get-GitHubRepositoryTeam.ps1 | 4 ++-- .../Repositories/Get-GitHubRepositoryTopic.ps1 | 4 ++-- .../Repositories/Move-GitHubRepository.ps1 | 4 ++-- .../Repositories/Repositories/New-GitHubRepository.ps1 | 2 +- .../Repositories/Remove-GitHubRepository.ps1 | 4 ++-- .../Repositories/Set-GitHubRepositoryTopic.ps1 | 4 ++-- .../Repositories/Start-GitHubRepositoryEvent.ps1 | 4 ++-- .../Test-GitHubRepositoryVulnerabilityAlert.ps1 | 4 ++-- .../Repositories/Update-GitHubRepository.ps1 | 4 ++-- .../RuleSuite/Get-GitHubRepositoryRuleSuite.ps1 | 4 ++-- .../RuleSuite/Get-GitHubRepositoryRuleSuiteById.ps1 | 4 ++-- .../RuleSuite/Get-GitHubRepositoryRuleSuiteList.ps1 | 4 ++-- .../Tags/Get-GitHubRepositoryTagProtection.ps1 | 4 ++-- .../Tags/New-GitHubRepositoryTagProtection.ps1 | 4 ++-- .../Tags/Remove-GitHubRepositoryTagProtection.ps1 | 4 ++-- src/functions/public/Teams/Get-GitHubRepoTeam.ps1 | 4 ++-- src/functions/public/Teams/Get-GitHubTeamByName.ps1 | 2 +- src/functions/public/Teams/Get-GitHubTeamListByOrg.ps1 | 2 +- src/functions/public/Teams/New-GitHubTeam.ps1 | 2 +- src/functions/public/Teams/Remove-GitHubTeam.ps1 | 2 +- src/functions/public/Teams/Update-GitHubTeam.ps1 | 2 +- .../public/Users/Blocking/Get-GitHubBlockedUser.ps1 | 2 +- .../public/Users/Blocking/Test-GitHubBlockedUser.ps1 | 2 +- .../public/Users/Blocking/Unblock-GitHubUser.ps1 | 2 +- 93 files changed, 163 insertions(+), 169 deletions(-) diff --git a/src/functions/private/Actions/Get-GitHubWorkflowRunByRepo.ps1 b/src/functions/private/Actions/Get-GitHubWorkflowRunByRepo.ps1 index 87944eaa..9032bef8 100644 --- a/src/functions/private/Actions/Get-GitHubWorkflowRunByRepo.ps1 +++ b/src/functions/private/Actions/Get-GitHubWorkflowRunByRepo.ps1 @@ -95,12 +95,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/private/Actions/Get-GitHubWorkflowRunByWorkflow.ps1 b/src/functions/private/Actions/Get-GitHubWorkflowRunByWorkflow.ps1 index 8e230df0..e07a5fbc 100644 --- a/src/functions/private/Actions/Get-GitHubWorkflowRunByWorkflow.ps1 +++ b/src/functions/private/Actions/Get-GitHubWorkflowRunByWorkflow.ps1 @@ -102,12 +102,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/private/License/Get-GitHubRepositoryLicense.ps1 b/src/functions/private/License/Get-GitHubRepositoryLicense.ps1 index d2363b01..e4e60901 100644 --- a/src/functions/private/License/Get-GitHubRepositoryLicense.ps1 +++ b/src/functions/private/License/Get-GitHubRepositoryLicense.ps1 @@ -43,12 +43,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/private/Releases/Assets/Get-GitHubReleaseAssetByID.ps1 b/src/functions/private/Releases/Assets/Get-GitHubReleaseAssetByID.ps1 index 5bcd7b49..c4069235 100644 --- a/src/functions/private/Releases/Assets/Get-GitHubReleaseAssetByID.ps1 +++ b/src/functions/private/Releases/Assets/Get-GitHubReleaseAssetByID.ps1 @@ -47,12 +47,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/private/Releases/Assets/Get-GitHubReleaseAssetByReleaseID.ps1 b/src/functions/private/Releases/Assets/Get-GitHubReleaseAssetByReleaseID.ps1 index 2b949bd9..8e9fcc7f 100644 --- a/src/functions/private/Releases/Assets/Get-GitHubReleaseAssetByReleaseID.ps1 +++ b/src/functions/private/Releases/Assets/Get-GitHubReleaseAssetByReleaseID.ps1 @@ -52,12 +52,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/private/Releases/Releases/Get-GitHubReleaseAll.ps1 b/src/functions/private/Releases/Releases/Get-GitHubReleaseAll.ps1 index c66121d3..c35157bb 100644 --- a/src/functions/private/Releases/Releases/Get-GitHubReleaseAll.ps1 +++ b/src/functions/private/Releases/Releases/Get-GitHubReleaseAll.ps1 @@ -46,12 +46,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/private/Releases/Releases/Get-GitHubReleaseByID.ps1 b/src/functions/private/Releases/Releases/Get-GitHubReleaseByID.ps1 index 536b3d68..5f60d311 100644 --- a/src/functions/private/Releases/Releases/Get-GitHubReleaseByID.ps1 +++ b/src/functions/private/Releases/Releases/Get-GitHubReleaseByID.ps1 @@ -45,12 +45,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/private/Releases/Releases/Get-GitHubReleaseByTagName.ps1 b/src/functions/private/Releases/Releases/Get-GitHubReleaseByTagName.ps1 index 572f2f55..156454bc 100644 --- a/src/functions/private/Releases/Releases/Get-GitHubReleaseByTagName.ps1 +++ b/src/functions/private/Releases/Releases/Get-GitHubReleaseByTagName.ps1 @@ -44,12 +44,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/private/Releases/Releases/Get-GitHubReleaseLatest.ps1 b/src/functions/private/Releases/Releases/Get-GitHubReleaseLatest.ps1 index 03f0d931..8c032589 100644 --- a/src/functions/private/Releases/Releases/Get-GitHubReleaseLatest.ps1 +++ b/src/functions/private/Releases/Releases/Get-GitHubReleaseLatest.ps1 @@ -41,12 +41,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/private/Repositories/Autolinks/Get-GitHubRepositoryAutolinkById.ps1 b/src/functions/private/Repositories/Autolinks/Get-GitHubRepositoryAutolinkById.ps1 index 1b9e2614..3a93ca72 100644 --- a/src/functions/private/Repositories/Autolinks/Get-GitHubRepositoryAutolinkById.ps1 +++ b/src/functions/private/Repositories/Autolinks/Get-GitHubRepositoryAutolinkById.ps1 @@ -48,12 +48,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/private/Repositories/Autolinks/Get-GitHubRepositoryAutolinkList.ps1 b/src/functions/private/Repositories/Autolinks/Get-GitHubRepositoryAutolinkList.ps1 index 89dacc33..d4273641 100644 --- a/src/functions/private/Repositories/Autolinks/Get-GitHubRepositoryAutolinkList.ps1 +++ b/src/functions/private/Repositories/Autolinks/Get-GitHubRepositoryAutolinkList.ps1 @@ -42,12 +42,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/private/Repositories/Fork/New-GitHubRepositoryAsFork.ps1 b/src/functions/private/Repositories/Fork/New-GitHubRepositoryAsFork.ps1 index e544d7fc..0a1e85d8 100644 --- a/src/functions/private/Repositories/Fork/New-GitHubRepositoryAsFork.ps1 +++ b/src/functions/private/Repositories/Fork/New-GitHubRepositoryAsFork.ps1 @@ -76,17 +76,17 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" if ([string]::IsNullorEmpty($Name)) { $Name = $Repo } - Write-Debug "Name : [$Name]" + Write-Debug "Name: [$Name]" } process { diff --git a/src/functions/private/Repositories/Repositories/Get-GitHubRepositoryByName.ps1 b/src/functions/private/Repositories/Repositories/Get-GitHubRepositoryByName.ps1 index c8b7fdaf..ff9b5f24 100644 --- a/src/functions/private/Repositories/Repositories/Get-GitHubRepositoryByName.ps1 +++ b/src/functions/private/Repositories/Repositories/Get-GitHubRepositoryByName.ps1 @@ -44,12 +44,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/private/Repositories/Repositories/Get-GitHubRepositoryListByOrg.ps1 b/src/functions/private/Repositories/Repositories/Get-GitHubRepositoryListByOrg.ps1 index b77f4e68..2e24b3ac 100644 --- a/src/functions/private/Repositories/Repositories/Get-GitHubRepositoryListByOrg.ps1 +++ b/src/functions/private/Repositories/Repositories/Get-GitHubRepositoryListByOrg.ps1 @@ -70,7 +70,7 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" } process { diff --git a/src/functions/private/Repositories/Repositories/Get-GitHubRepositoryListByUser.ps1 b/src/functions/private/Repositories/Repositories/Get-GitHubRepositoryListByUser.ps1 index 23ca4664..70d5133e 100644 --- a/src/functions/private/Repositories/Repositories/Get-GitHubRepositoryListByUser.ps1 +++ b/src/functions/private/Repositories/Repositories/Get-GitHubRepositoryListByUser.ps1 @@ -72,12 +72,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/private/Repositories/Repositories/New-GitHubRepositoryFromTemplate.ps1 b/src/functions/private/Repositories/Repositories/New-GitHubRepositoryFromTemplate.ps1 index 9b212da4..f9bfe16b 100644 --- a/src/functions/private/Repositories/Repositories/New-GitHubRepositoryFromTemplate.ps1 +++ b/src/functions/private/Repositories/Repositories/New-GitHubRepositoryFromTemplate.ps1 @@ -86,7 +86,7 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" } process { diff --git a/src/functions/private/Repositories/Repositories/New-GitHubRepositoryOrg.ps1 b/src/functions/private/Repositories/Repositories/New-GitHubRepositoryOrg.ps1 index 4e4e0730..1eddfd0b 100644 --- a/src/functions/private/Repositories/Repositories/New-GitHubRepositoryOrg.ps1 +++ b/src/functions/private/Repositories/Repositories/New-GitHubRepositoryOrg.ps1 @@ -221,7 +221,7 @@ filter New-GitHubRepositoryOrg { if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" } process { diff --git a/src/functions/public/API/Invoke-GitHubAPI.ps1 b/src/functions/public/API/Invoke-GitHubAPI.ps1 index e4be2005..af1dd5cc 100644 --- a/src/functions/public/API/Invoke-GitHubAPI.ps1 +++ b/src/functions/public/API/Invoke-GitHubAPI.ps1 @@ -105,12 +105,12 @@ if ([string]::IsNullOrEmpty($ApiBaseUri)) { $ApiBaseUri = $Context.ApiBaseUri } - Write-Debug "ApiBaseUri : [$($Context.ApiBaseUri)]" + Write-Debug "ApiBaseUri: [$($Context.ApiBaseUri)]" if ([string]::IsNullOrEmpty($ApiVersion)) { $ApiVersion = $Context.ApiVersion } - Write-Debug "ApiVersion : [$($Context.ApiVersion)]" + Write-Debug "ApiVersion: [$($Context.ApiVersion)]" switch ($TokenType) { 'ghu' { diff --git a/src/functions/public/Actions/Disable-GitHubWorkflow.ps1 b/src/functions/public/Actions/Disable-GitHubWorkflow.ps1 index 61cb6367..62baac08 100644 --- a/src/functions/public/Actions/Disable-GitHubWorkflow.ps1 +++ b/src/functions/public/Actions/Disable-GitHubWorkflow.ps1 @@ -34,12 +34,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/public/Actions/Enable-GitHubWorkflow.ps1 b/src/functions/public/Actions/Enable-GitHubWorkflow.ps1 index b5529881..45c72dfb 100644 --- a/src/functions/public/Actions/Enable-GitHubWorkflow.ps1 +++ b/src/functions/public/Actions/Enable-GitHubWorkflow.ps1 @@ -31,12 +31,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/public/Actions/Get-GitHubWorkflow.ps1 b/src/functions/public/Actions/Get-GitHubWorkflow.ps1 index d6cfa0f5..fb86ae7b 100644 --- a/src/functions/public/Actions/Get-GitHubWorkflow.ps1 +++ b/src/functions/public/Actions/Get-GitHubWorkflow.ps1 @@ -48,12 +48,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/public/Actions/Get-GitHubWorkflowRun.ps1 b/src/functions/public/Actions/Get-GitHubWorkflowRun.ps1 index 0d989c37..ca87abfd 100644 --- a/src/functions/public/Actions/Get-GitHubWorkflowRun.ps1 +++ b/src/functions/public/Actions/Get-GitHubWorkflowRun.ps1 @@ -122,12 +122,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/public/Actions/Get-GitHubWorkflowUsage.ps1 b/src/functions/public/Actions/Get-GitHubWorkflowUsage.ps1 index bd9601b0..47fa47ad 100644 --- a/src/functions/public/Actions/Get-GitHubWorkflowUsage.ps1 +++ b/src/functions/public/Actions/Get-GitHubWorkflowUsage.ps1 @@ -42,12 +42,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/public/Actions/Remove-GitHubWorkflowRun.ps1 b/src/functions/public/Actions/Remove-GitHubWorkflowRun.ps1 index f1c163e7..230f5094 100644 --- a/src/functions/public/Actions/Remove-GitHubWorkflowRun.ps1 +++ b/src/functions/public/Actions/Remove-GitHubWorkflowRun.ps1 @@ -48,12 +48,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/public/Actions/Start-GitHubWorkflow.ps1 b/src/functions/public/Actions/Start-GitHubWorkflow.ps1 index ad00db1c..67cae215 100644 --- a/src/functions/public/Actions/Start-GitHubWorkflow.ps1 +++ b/src/functions/public/Actions/Start-GitHubWorkflow.ps1 @@ -60,12 +60,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/public/Actions/Start-GitHubWorkflowReRun.ps1 b/src/functions/public/Actions/Start-GitHubWorkflowReRun.ps1 index 05bfef04..183775e2 100644 --- a/src/functions/public/Actions/Start-GitHubWorkflowReRun.ps1 +++ b/src/functions/public/Actions/Start-GitHubWorkflowReRun.ps1 @@ -44,12 +44,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/public/Actions/Stop-GitHubWorkflowRun.ps1 b/src/functions/public/Actions/Stop-GitHubWorkflowRun.ps1 index 36c06faf..57ee67c6 100644 --- a/src/functions/public/Actions/Stop-GitHubWorkflowRun.ps1 +++ b/src/functions/public/Actions/Stop-GitHubWorkflowRun.ps1 @@ -44,12 +44,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/public/Apps/GitHub Apps/Get-GitHubApp.ps1 b/src/functions/public/Apps/GitHub Apps/Get-GitHubApp.ps1 index 26f91fa7..f77eb9b1 100644 --- a/src/functions/public/Apps/GitHub Apps/Get-GitHubApp.ps1 +++ b/src/functions/public/Apps/GitHub Apps/Get-GitHubApp.ps1 @@ -47,12 +47,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/public/Branches/Get-GitHubRepoBranch.ps1 b/src/functions/public/Branches/Get-GitHubRepoBranch.ps1 index 03002733..eea9e1b8 100644 --- a/src/functions/public/Branches/Get-GitHubRepoBranch.ps1 +++ b/src/functions/public/Branches/Get-GitHubRepoBranch.ps1 @@ -38,12 +38,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/public/Enterprise/Get-GitHubEnterpriseInstallableOrganization.ps1 b/src/functions/public/Enterprise/Get-GitHubEnterpriseInstallableOrganization.ps1 index ebe26471..526e6938 100644 --- a/src/functions/public/Enterprise/Get-GitHubEnterpriseInstallableOrganization.ps1 +++ b/src/functions/public/Enterprise/Get-GitHubEnterpriseInstallableOrganization.ps1 @@ -32,7 +32,7 @@ if ([string]::IsNullOrEmpty($Enterprise)) { $Enterprise = $Context.Enterprise } - Write-Debug "Enterprise : [$($Context.Enterprise)]" + Write-Debug "Enterprise: [$Enterprise]" } process { diff --git a/src/functions/public/Enterprise/Get-GitHubEnterpriseOrganization.ps1 b/src/functions/public/Enterprise/Get-GitHubEnterpriseOrganization.ps1 index 819420e2..adbb0deb 100644 --- a/src/functions/public/Enterprise/Get-GitHubEnterpriseOrganization.ps1 +++ b/src/functions/public/Enterprise/Get-GitHubEnterpriseOrganization.ps1 @@ -28,7 +28,7 @@ if ([string]::IsNullOrEmpty($Enterprise)) { $Enterprise = $Context.Enterprise } - Write-Debug "Enterprise : [$($Context.Enterprise)]" + Write-Debug "Enterprise: [$Enterprise]" } process { diff --git a/src/functions/public/Enterprise/Install-GitHubAppOnEnterpriseOrganization.ps1 b/src/functions/public/Enterprise/Install-GitHubAppOnEnterpriseOrganization.ps1 index 69455a25..3b6d6df5 100644 --- a/src/functions/public/Enterprise/Install-GitHubAppOnEnterpriseOrganization.ps1 +++ b/src/functions/public/Enterprise/Install-GitHubAppOnEnterpriseOrganization.ps1 @@ -50,7 +50,7 @@ if ([string]::IsNullOrEmpty($Enterprise)) { $Enterprise = $Context.Enterprise } - Write-Debug "Enterprise : [$($Context.Enterprise)]" + Write-Debug "Enterprise: [$Enterprise]" } process { diff --git a/src/functions/public/Gitignore/Get-GitHubGitignore.ps1 b/src/functions/public/Gitignore/Get-GitHubGitignore.ps1 index 4dacac03..70ae5b2f 100644 --- a/src/functions/public/Gitignore/Get-GitHubGitignore.ps1 +++ b/src/functions/public/Gitignore/Get-GitHubGitignore.ps1 @@ -56,7 +56,7 @@ filter Get-GitHubGitignore { if ([string]::IsNullOrEmpty($Enterprise)) { $Enterprise = $Context.Enterprise } - Write-Debug "Enterprise : [$($Context.Enterprise)]" + Write-Debug "Enterprise: [$Enterprise]" } process { diff --git a/src/functions/public/License/Get-GitHubLicense.ps1 b/src/functions/public/License/Get-GitHubLicense.ps1 index 837aa368..1b3bd66b 100644 --- a/src/functions/public/License/Get-GitHubLicense.ps1 +++ b/src/functions/public/License/Get-GitHubLicense.ps1 @@ -74,12 +74,12 @@ filter Get-GitHubLicense { if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/public/Organization/Get-GitHubOrganization.ps1 b/src/functions/public/Organization/Get-GitHubOrganization.ps1 index a58bd80b..962f7194 100644 --- a/src/functions/public/Organization/Get-GitHubOrganization.ps1 +++ b/src/functions/public/Organization/Get-GitHubOrganization.ps1 @@ -88,7 +88,7 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" } process { diff --git a/src/functions/public/Organization/Get-GitHubOrganizationAppInstallation.ps1 b/src/functions/public/Organization/Get-GitHubOrganizationAppInstallation.ps1 index 3a59def9..6df2ab51 100644 --- a/src/functions/public/Organization/Get-GitHubOrganizationAppInstallation.ps1 +++ b/src/functions/public/Organization/Get-GitHubOrganizationAppInstallation.ps1 @@ -50,7 +50,7 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" } process { diff --git a/src/functions/public/Organization/Members/Get-GitHubOrganizationMember.ps1 b/src/functions/public/Organization/Members/Get-GitHubOrganizationMember.ps1 index efd7b1ba..05f0f1c5 100644 --- a/src/functions/public/Organization/Members/Get-GitHubOrganizationMember.ps1 +++ b/src/functions/public/Organization/Members/Get-GitHubOrganizationMember.ps1 @@ -50,7 +50,7 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" } process { diff --git a/src/functions/public/Organization/Members/Get-GitHubOrganizationPendingInvitation.ps1 b/src/functions/public/Organization/Members/Get-GitHubOrganizationPendingInvitation.ps1 index 7e0c0feb..a9c4f8ac 100644 --- a/src/functions/public/Organization/Members/Get-GitHubOrganizationPendingInvitation.ps1 +++ b/src/functions/public/Organization/Members/Get-GitHubOrganizationPendingInvitation.ps1 @@ -49,7 +49,7 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" } process { diff --git a/src/functions/public/Organization/Members/New-GitHubOrganizationInvitation.ps1 b/src/functions/public/Organization/Members/New-GitHubOrganizationInvitation.ps1 index c2b34e17..810fceef 100644 --- a/src/functions/public/Organization/Members/New-GitHubOrganizationInvitation.ps1 +++ b/src/functions/public/Organization/Members/New-GitHubOrganizationInvitation.ps1 @@ -68,7 +68,7 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" } process { diff --git a/src/functions/public/Organization/Remove-GitHubOrganization.ps1 b/src/functions/public/Organization/Remove-GitHubOrganization.ps1 index 4bcdae43..55bc153c 100644 --- a/src/functions/public/Organization/Remove-GitHubOrganization.ps1 +++ b/src/functions/public/Organization/Remove-GitHubOrganization.ps1 @@ -46,7 +46,7 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" } process { diff --git a/src/functions/public/Organization/Set-GitHubOrganization.ps1 b/src/functions/public/Organization/Set-GitHubOrganization.ps1 index c067fd5a..8849558b 100644 --- a/src/functions/public/Organization/Set-GitHubOrganization.ps1 +++ b/src/functions/public/Organization/Set-GitHubOrganization.ps1 @@ -236,7 +236,7 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" } process { diff --git a/src/functions/public/Organization/Set-GitHubOrganizationSecurityFeature.ps1 b/src/functions/public/Organization/Set-GitHubOrganizationSecurityFeature.ps1 index 89b1e498..b87d0d20 100644 --- a/src/functions/public/Organization/Set-GitHubOrganizationSecurityFeature.ps1 +++ b/src/functions/public/Organization/Set-GitHubOrganizationSecurityFeature.ps1 @@ -83,7 +83,7 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" } process { diff --git a/src/functions/public/Releases/Assets/Add-GitHubReleaseAsset.ps1 b/src/functions/public/Releases/Assets/Add-GitHubReleaseAsset.ps1 index 720a682d..8e0e02e7 100644 --- a/src/functions/public/Releases/Assets/Add-GitHubReleaseAsset.ps1 +++ b/src/functions/public/Releases/Assets/Add-GitHubReleaseAsset.ps1 @@ -92,12 +92,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/public/Releases/Assets/Get-GitHubReleaseAsset.ps1 b/src/functions/public/Releases/Assets/Get-GitHubReleaseAsset.ps1 index 83cc166b..d98588aa 100644 --- a/src/functions/public/Releases/Assets/Get-GitHubReleaseAsset.ps1 +++ b/src/functions/public/Releases/Assets/Get-GitHubReleaseAsset.ps1 @@ -62,12 +62,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/public/Releases/Assets/Remove-GitHubReleaseAsset.ps1 b/src/functions/public/Releases/Assets/Remove-GitHubReleaseAsset.ps1 index 2279bf07..c0b93b9e 100644 --- a/src/functions/public/Releases/Assets/Remove-GitHubReleaseAsset.ps1 +++ b/src/functions/public/Releases/Assets/Remove-GitHubReleaseAsset.ps1 @@ -45,12 +45,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/public/Releases/Assets/Set-GitHubReleaseAsset.ps1 b/src/functions/public/Releases/Assets/Set-GitHubReleaseAsset.ps1 index 72ca1921..5c5e4a32 100644 --- a/src/functions/public/Releases/Assets/Set-GitHubReleaseAsset.ps1 +++ b/src/functions/public/Releases/Assets/Set-GitHubReleaseAsset.ps1 @@ -58,12 +58,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/public/Releases/Releases/Get-GitHubRelease.ps1 b/src/functions/public/Releases/Releases/Get-GitHubRelease.ps1 index d6ac5412..e6c77e67 100644 --- a/src/functions/public/Releases/Releases/Get-GitHubRelease.ps1 +++ b/src/functions/public/Releases/Releases/Get-GitHubRelease.ps1 @@ -87,12 +87,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/public/Releases/Releases/New-GitHubRelease.ps1 b/src/functions/public/Releases/Releases/New-GitHubRelease.ps1 index 8378e2c6..b24e8dd1 100644 --- a/src/functions/public/Releases/Releases/New-GitHubRelease.ps1 +++ b/src/functions/public/Releases/Releases/New-GitHubRelease.ps1 @@ -92,12 +92,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/public/Releases/Releases/New-GitHubReleaseNote.ps1 b/src/functions/public/Releases/Releases/New-GitHubReleaseNote.ps1 index 2bdf7fe5..7404cd08 100644 --- a/src/functions/public/Releases/Releases/New-GitHubReleaseNote.ps1 +++ b/src/functions/public/Releases/Releases/New-GitHubReleaseNote.ps1 @@ -106,12 +106,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/public/Releases/Releases/Remove-GitHubRelease.ps1 b/src/functions/public/Releases/Releases/Remove-GitHubRelease.ps1 index a1e5407a..4f3f739e 100644 --- a/src/functions/public/Releases/Releases/Remove-GitHubRelease.ps1 +++ b/src/functions/public/Releases/Releases/Remove-GitHubRelease.ps1 @@ -48,12 +48,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/public/Releases/Releases/Set-GitHubRelease.ps1 b/src/functions/public/Releases/Releases/Set-GitHubRelease.ps1 index a0768d62..9b48fe06 100644 --- a/src/functions/public/Releases/Releases/Set-GitHubRelease.ps1 +++ b/src/functions/public/Releases/Releases/Set-GitHubRelease.ps1 @@ -89,12 +89,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/public/Repositories/Autolinks/Get-GitHubRepositoryAutolink.ps1 b/src/functions/public/Repositories/Autolinks/Get-GitHubRepositoryAutolink.ps1 index 81d9e24b..0763bccd 100644 --- a/src/functions/public/Repositories/Autolinks/Get-GitHubRepositoryAutolink.ps1 +++ b/src/functions/public/Repositories/Autolinks/Get-GitHubRepositoryAutolink.ps1 @@ -58,12 +58,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/public/Repositories/Autolinks/New-GitHubRepositoryAutolink.ps1 b/src/functions/public/Repositories/Autolinks/New-GitHubRepositoryAutolink.ps1 index e97fd0bb..b8c40b9b 100644 --- a/src/functions/public/Repositories/Autolinks/New-GitHubRepositoryAutolink.ps1 +++ b/src/functions/public/Repositories/Autolinks/New-GitHubRepositoryAutolink.ps1 @@ -58,12 +58,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/public/Repositories/Autolinks/Remove-GitHubRepositoryAutolink.ps1 b/src/functions/public/Repositories/Autolinks/Remove-GitHubRepositoryAutolink.ps1 index 628f4742..ff169a8b 100644 --- a/src/functions/public/Repositories/Autolinks/Remove-GitHubRepositoryAutolink.ps1 +++ b/src/functions/public/Repositories/Autolinks/Remove-GitHubRepositoryAutolink.ps1 @@ -49,12 +49,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/public/Repositories/CustomProperties/Get-GitHubRepositoryCustomProperty.ps1 b/src/functions/public/Repositories/CustomProperties/Get-GitHubRepositoryCustomProperty.ps1 index 296ac746..3d931004 100644 --- a/src/functions/public/Repositories/CustomProperties/Get-GitHubRepositoryCustomProperty.ps1 +++ b/src/functions/public/Repositories/CustomProperties/Get-GitHubRepositoryCustomProperty.ps1 @@ -45,12 +45,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/public/Repositories/Repositories/Disable-GitHubRepositoryPrivateVulnerabilityReporting.ps1 b/src/functions/public/Repositories/Repositories/Disable-GitHubRepositoryPrivateVulnerabilityReporting.ps1 index 780151af..a071b3bc 100644 --- a/src/functions/public/Repositories/Repositories/Disable-GitHubRepositoryPrivateVulnerabilityReporting.ps1 +++ b/src/functions/public/Repositories/Repositories/Disable-GitHubRepositoryPrivateVulnerabilityReporting.ps1 @@ -44,12 +44,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/public/Repositories/Repositories/Disable-GitHubRepositorySecurityFix.ps1 b/src/functions/public/Repositories/Repositories/Disable-GitHubRepositorySecurityFix.ps1 index ae0b6169..7cf6462f 100644 --- a/src/functions/public/Repositories/Repositories/Disable-GitHubRepositorySecurityFix.ps1 +++ b/src/functions/public/Repositories/Repositories/Disable-GitHubRepositorySecurityFix.ps1 @@ -44,12 +44,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/public/Repositories/Repositories/Disable-GitHubRepositoryVulnerabilityAlert.ps1 b/src/functions/public/Repositories/Repositories/Disable-GitHubRepositoryVulnerabilityAlert.ps1 index 24df3eb8..5064f3c8 100644 --- a/src/functions/public/Repositories/Repositories/Disable-GitHubRepositoryVulnerabilityAlert.ps1 +++ b/src/functions/public/Repositories/Repositories/Disable-GitHubRepositoryVulnerabilityAlert.ps1 @@ -43,12 +43,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/public/Repositories/Repositories/Enable-GitHubRepositoryPrivateVulnerabilityReporting.ps1 b/src/functions/public/Repositories/Repositories/Enable-GitHubRepositoryPrivateVulnerabilityReporting.ps1 index 82b852c0..b5b8da90 100644 --- a/src/functions/public/Repositories/Repositories/Enable-GitHubRepositoryPrivateVulnerabilityReporting.ps1 +++ b/src/functions/public/Repositories/Repositories/Enable-GitHubRepositoryPrivateVulnerabilityReporting.ps1 @@ -44,12 +44,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/public/Repositories/Repositories/Enable-GitHubRepositorySecurityFix.ps1 b/src/functions/public/Repositories/Repositories/Enable-GitHubRepositorySecurityFix.ps1 index c69b52b9..9d19d7e5 100644 --- a/src/functions/public/Repositories/Repositories/Enable-GitHubRepositorySecurityFix.ps1 +++ b/src/functions/public/Repositories/Repositories/Enable-GitHubRepositorySecurityFix.ps1 @@ -44,12 +44,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/public/Repositories/Repositories/Enable-GitHubRepositoryVulnerabilityAlert.ps1 b/src/functions/public/Repositories/Repositories/Enable-GitHubRepositoryVulnerabilityAlert.ps1 index 6c7afca7..eb5f09ed 100644 --- a/src/functions/public/Repositories/Repositories/Enable-GitHubRepositoryVulnerabilityAlert.ps1 +++ b/src/functions/public/Repositories/Repositories/Enable-GitHubRepositoryVulnerabilityAlert.ps1 @@ -44,12 +44,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/public/Repositories/Repositories/Get-GitHubRepository.ps1 b/src/functions/public/Repositories/Repositories/Get-GitHubRepository.ps1 index 8c73b31c..0f400433 100644 --- a/src/functions/public/Repositories/Repositories/Get-GitHubRepository.ps1 +++ b/src/functions/public/Repositories/Repositories/Get-GitHubRepository.ps1 @@ -170,12 +170,12 @@ filter Get-GitHubRepository { if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { @@ -193,7 +193,6 @@ filter Get-GitHubRepository { Since = $Since Before = $Before } | Remove-HashtableEntry -NullOrEmptyValues - $params | Format-Table -AutoSize | Out-String -Stream | ForEach-Object { Write-Debug $_ } Get-GitHubMyRepositories @params } 'MyRepos_Aff-Vis' { @@ -207,7 +206,6 @@ filter Get-GitHubRepository { Since = $Since Before = $Before } | Remove-HashtableEntry -NullOrEmptyValues - $params | Format-Table -AutoSize | Out-String -Stream | ForEach-Object { Write-Debug $_ } Get-GitHubMyRepositories @params } 'ByName' { @@ -216,7 +214,6 @@ filter Get-GitHubRepository { Owner = $Owner Repo = $Repo } | Remove-HashtableEntry -NullOrEmptyValues - $params | Format-Table -AutoSize | Out-String -Stream | ForEach-Object { Write-Debug $_ } Get-GitHubRepositoryByName @params } 'ListByID' { @@ -224,7 +221,6 @@ filter Get-GitHubRepository { Context = $Context Since = $SinceID } | Remove-HashtableEntry -NullOrEmptyValues - $params | Format-Table -AutoSize | Out-String -Stream | ForEach-Object { Write-Debug $_ } Get-GitHubRepositoryListByID @params } 'ListByOrg' { @@ -236,7 +232,6 @@ filter Get-GitHubRepository { Direction = $Direction PerPage = $PerPage } | Remove-HashtableEntry -NullOrEmptyValues - $params | Format-Table -AutoSize | Out-String -Stream | ForEach-Object { Write-Debug $_ } Get-GitHubRepositoryListByOrg @params } 'ListByUser' { @@ -248,7 +243,6 @@ filter Get-GitHubRepository { Direction = $Direction PerPage = $PerPage } | Remove-HashtableEntry -NullOrEmptyValues - $params | Format-Table -AutoSize | Out-String -Stream | ForEach-Object { Write-Debug $_ } Get-GitHubRepositoryListByUser @params } } diff --git a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryActivity.ps1 b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryActivity.ps1 index 3bd3a75f..a540209f 100644 --- a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryActivity.ps1 +++ b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryActivity.ps1 @@ -118,12 +118,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryCodeownersError.ps1 b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryCodeownersError.ps1 index 1fd3d896..32c70da1 100644 --- a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryCodeownersError.ps1 +++ b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryCodeownersError.ps1 @@ -50,12 +50,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryContributor.ps1 b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryContributor.ps1 index 6bcd2a7d..ce84b00c 100644 --- a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryContributor.ps1 +++ b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryContributor.ps1 @@ -55,12 +55,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryFork.ps1 b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryFork.ps1 index e4aa5212..d2bf7914 100644 --- a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryFork.ps1 +++ b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryFork.ps1 @@ -51,12 +51,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryLanguage.ps1 b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryLanguage.ps1 index 73dd8b74..82a6c7fa 100644 --- a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryLanguage.ps1 +++ b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryLanguage.ps1 @@ -43,12 +43,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/public/Repositories/Repositories/Get-GitHubRepositorySecurityFix.ps1 b/src/functions/public/Repositories/Repositories/Get-GitHubRepositorySecurityFix.ps1 index cd927d9f..ae1b1c0f 100644 --- a/src/functions/public/Repositories/Repositories/Get-GitHubRepositorySecurityFix.ps1 +++ b/src/functions/public/Repositories/Repositories/Get-GitHubRepositorySecurityFix.ps1 @@ -45,12 +45,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryTag.ps1 b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryTag.ps1 index 20c1d86a..bf10c8c0 100644 --- a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryTag.ps1 +++ b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryTag.ps1 @@ -47,12 +47,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryTeam.ps1 b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryTeam.ps1 index 2ddc6e7c..4e13bcce 100644 --- a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryTeam.ps1 +++ b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryTeam.ps1 @@ -55,12 +55,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryTopic.ps1 b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryTopic.ps1 index f32dec85..ee17bf3b 100644 --- a/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryTopic.ps1 +++ b/src/functions/public/Repositories/Repositories/Get-GitHubRepositoryTopic.ps1 @@ -43,12 +43,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/public/Repositories/Repositories/Move-GitHubRepository.ps1 b/src/functions/public/Repositories/Repositories/Move-GitHubRepository.ps1 index 442394f1..a5031374 100644 --- a/src/functions/public/Repositories/Repositories/Move-GitHubRepository.ps1 +++ b/src/functions/public/Repositories/Repositories/Move-GitHubRepository.ps1 @@ -61,12 +61,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/public/Repositories/Repositories/New-GitHubRepository.ps1 b/src/functions/public/Repositories/Repositories/New-GitHubRepository.ps1 index 8f4685d0..22321f99 100644 --- a/src/functions/public/Repositories/Repositories/New-GitHubRepository.ps1 +++ b/src/functions/public/Repositories/Repositories/New-GitHubRepository.ps1 @@ -336,7 +336,7 @@ filter New-GitHubRepository { if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" } process { diff --git a/src/functions/public/Repositories/Repositories/Remove-GitHubRepository.ps1 b/src/functions/public/Repositories/Repositories/Remove-GitHubRepository.ps1 index 568a69aa..c04cf4f9 100644 --- a/src/functions/public/Repositories/Repositories/Remove-GitHubRepository.ps1 +++ b/src/functions/public/Repositories/Repositories/Remove-GitHubRepository.ps1 @@ -45,12 +45,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/public/Repositories/Repositories/Set-GitHubRepositoryTopic.ps1 b/src/functions/public/Repositories/Repositories/Set-GitHubRepositoryTopic.ps1 index 9c6e4a23..ef4b0a14 100644 --- a/src/functions/public/Repositories/Repositories/Set-GitHubRepositoryTopic.ps1 +++ b/src/functions/public/Repositories/Repositories/Set-GitHubRepositoryTopic.ps1 @@ -45,12 +45,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/public/Repositories/Repositories/Start-GitHubRepositoryEvent.ps1 b/src/functions/public/Repositories/Repositories/Start-GitHubRepositoryEvent.ps1 index c835d709..e16d39a1 100644 --- a/src/functions/public/Repositories/Repositories/Start-GitHubRepositoryEvent.ps1 +++ b/src/functions/public/Repositories/Repositories/Start-GitHubRepositoryEvent.ps1 @@ -78,12 +78,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/public/Repositories/Repositories/Test-GitHubRepositoryVulnerabilityAlert.ps1 b/src/functions/public/Repositories/Repositories/Test-GitHubRepositoryVulnerabilityAlert.ps1 index 14d06618..9a2af0ec 100644 --- a/src/functions/public/Repositories/Repositories/Test-GitHubRepositoryVulnerabilityAlert.ps1 +++ b/src/functions/public/Repositories/Repositories/Test-GitHubRepositoryVulnerabilityAlert.ps1 @@ -45,12 +45,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/public/Repositories/Repositories/Update-GitHubRepository.ps1 b/src/functions/public/Repositories/Repositories/Update-GitHubRepository.ps1 index a9514f5e..e50193f9 100644 --- a/src/functions/public/Repositories/Repositories/Update-GitHubRepository.ps1 +++ b/src/functions/public/Repositories/Repositories/Update-GitHubRepository.ps1 @@ -186,12 +186,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuite.ps1 b/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuite.ps1 index 64a40b3f..5964f324 100644 --- a/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuite.ps1 +++ b/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuite.ps1 @@ -91,12 +91,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuiteById.ps1 b/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuiteById.ps1 index 0ef21c33..548c94ef 100644 --- a/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuiteById.ps1 +++ b/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuiteById.ps1 @@ -47,12 +47,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuiteList.ps1 b/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuiteList.ps1 index 03304a13..29c6cf3a 100644 --- a/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuiteList.ps1 +++ b/src/functions/public/Repositories/RuleSuite/Get-GitHubRepositoryRuleSuiteList.ps1 @@ -78,12 +78,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/public/Repositories/Tags/Get-GitHubRepositoryTagProtection.ps1 b/src/functions/public/Repositories/Tags/Get-GitHubRepositoryTagProtection.ps1 index 5a955a25..29c5ef88 100644 --- a/src/functions/public/Repositories/Tags/Get-GitHubRepositoryTagProtection.ps1 +++ b/src/functions/public/Repositories/Tags/Get-GitHubRepositoryTagProtection.ps1 @@ -44,12 +44,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/public/Repositories/Tags/New-GitHubRepositoryTagProtection.ps1 b/src/functions/public/Repositories/Tags/New-GitHubRepositoryTagProtection.ps1 index 73002dc4..ab3a1fce 100644 --- a/src/functions/public/Repositories/Tags/New-GitHubRepositoryTagProtection.ps1 +++ b/src/functions/public/Repositories/Tags/New-GitHubRepositoryTagProtection.ps1 @@ -46,12 +46,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/public/Repositories/Tags/Remove-GitHubRepositoryTagProtection.ps1 b/src/functions/public/Repositories/Tags/Remove-GitHubRepositoryTagProtection.ps1 index e86fc7f8..94bb00ec 100644 --- a/src/functions/public/Repositories/Tags/Remove-GitHubRepositoryTagProtection.ps1 +++ b/src/functions/public/Repositories/Tags/Remove-GitHubRepositoryTagProtection.ps1 @@ -47,12 +47,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/public/Teams/Get-GitHubRepoTeam.ps1 b/src/functions/public/Teams/Get-GitHubRepoTeam.ps1 index 74757ed3..2db1a32c 100644 --- a/src/functions/public/Teams/Get-GitHubRepoTeam.ps1 +++ b/src/functions/public/Teams/Get-GitHubRepoTeam.ps1 @@ -26,12 +26,12 @@ if ([string]::IsNullOrEmpty($Owner)) { $Owner = $Context.Owner } - Write-Debug "Owner : [$($Context.Owner)]" + Write-Debug "Owner: [$Owner]" if ([string]::IsNullOrEmpty($Repo)) { $Repo = $Context.Repo } - Write-Debug "Repo : [$($Context.Repo)]" + Write-Debug "Repo: [$Repo]" } process { diff --git a/src/functions/public/Teams/Get-GitHubTeamByName.ps1 b/src/functions/public/Teams/Get-GitHubTeamByName.ps1 index 6d275c72..9c023176 100644 --- a/src/functions/public/Teams/Get-GitHubTeamByName.ps1 +++ b/src/functions/public/Teams/Get-GitHubTeamByName.ps1 @@ -41,7 +41,7 @@ if ([string]::IsNullOrEmpty($Organization)) { $Organization = $Context.Owner } - Write-Debug "Organization : [$($Context.Owner)]" + Write-Debug "Organization: [$Organization]" } process { diff --git a/src/functions/public/Teams/Get-GitHubTeamListByOrg.ps1 b/src/functions/public/Teams/Get-GitHubTeamListByOrg.ps1 index 40ace7c3..fb8cf4ec 100644 --- a/src/functions/public/Teams/Get-GitHubTeamListByOrg.ps1 +++ b/src/functions/public/Teams/Get-GitHubTeamListByOrg.ps1 @@ -35,7 +35,7 @@ if ([string]::IsNullOrEmpty($Organization)) { $Organization = $Context.Owner } - Write-Debug "Organization : [$($Context.Owner)]" + Write-Debug "Organization: [$Organization]" } process { diff --git a/src/functions/public/Teams/New-GitHubTeam.ps1 b/src/functions/public/Teams/New-GitHubTeam.ps1 index 8a14deca..858de9a7 100644 --- a/src/functions/public/Teams/New-GitHubTeam.ps1 +++ b/src/functions/public/Teams/New-GitHubTeam.ps1 @@ -94,7 +94,7 @@ if ([string]::IsNullOrEmpty($Organization)) { $Organization = $Context.Owner } - Write-Debug "Organization : [$($Context.Owner)]" + Write-Debug "Organization: [$Organization]" } process { diff --git a/src/functions/public/Teams/Remove-GitHubTeam.ps1 b/src/functions/public/Teams/Remove-GitHubTeam.ps1 index 84a3152f..ac836f9b 100644 --- a/src/functions/public/Teams/Remove-GitHubTeam.ps1 +++ b/src/functions/public/Teams/Remove-GitHubTeam.ps1 @@ -41,7 +41,7 @@ if ([string]::IsNullOrEmpty($Organization)) { $Organization = $Context.Owner } - Write-Debug "Organization : [$($Context.Owner)]" + Write-Debug "Organization: [$Organization]" } process { diff --git a/src/functions/public/Teams/Update-GitHubTeam.ps1 b/src/functions/public/Teams/Update-GitHubTeam.ps1 index 79937b1f..c87d1e8f 100644 --- a/src/functions/public/Teams/Update-GitHubTeam.ps1 +++ b/src/functions/public/Teams/Update-GitHubTeam.ps1 @@ -88,7 +88,7 @@ if ([string]::IsNullOrEmpty($Organization)) { $Organization = $Context.Owner } - Write-Debug "Organization : [$($Context.Owner)]" + Write-Debug "Organization: [$Organization]" } process { diff --git a/src/functions/public/Users/Blocking/Get-GitHubBlockedUser.ps1 b/src/functions/public/Users/Blocking/Get-GitHubBlockedUser.ps1 index 867d20cf..b375ab44 100644 --- a/src/functions/public/Users/Blocking/Get-GitHubBlockedUser.ps1 +++ b/src/functions/public/Users/Blocking/Get-GitHubBlockedUser.ps1 @@ -53,7 +53,7 @@ if ([string]::IsNullOrEmpty($Organization)) { $Organization = $Context.Owner } - Write-Debug "Organization : [$($Context.Owner)]" + Write-Debug "Organization: [$Organization]" } process { diff --git a/src/functions/public/Users/Blocking/Test-GitHubBlockedUser.ps1 b/src/functions/public/Users/Blocking/Test-GitHubBlockedUser.ps1 index 33df8483..cf829991 100644 --- a/src/functions/public/Users/Blocking/Test-GitHubBlockedUser.ps1 +++ b/src/functions/public/Users/Blocking/Test-GitHubBlockedUser.ps1 @@ -65,7 +65,7 @@ if ([string]::IsNullOrEmpty($Organization)) { $Organization = $Context.Owner } - Write-Debug "Organization : [$($Context.Owner)]" + Write-Debug "Organization: [$Organization]" } process { diff --git a/src/functions/public/Users/Blocking/Unblock-GitHubUser.ps1 b/src/functions/public/Users/Blocking/Unblock-GitHubUser.ps1 index 9dcf3504..38b54124 100644 --- a/src/functions/public/Users/Blocking/Unblock-GitHubUser.ps1 +++ b/src/functions/public/Users/Blocking/Unblock-GitHubUser.ps1 @@ -58,7 +58,7 @@ if ([string]::IsNullOrEmpty($Organization)) { $Organization = $Context.Owner } - Write-Debug "Organization : [$($Context.Owner)]" + Write-Debug "Organization: [$Organization]" } process { From 7fb98b03a409b78f6bf3230646b61f246efc9162 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Mon, 16 Dec 2024 01:58:06 +0100 Subject: [PATCH 23/24] Enhance parameter handling in Get-GitHubRepository function by adding verbose output and ensuring null or empty values are removed consistently --- .../Repositories/Get-GitHubRepository.ps1 | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/src/functions/public/Repositories/Repositories/Get-GitHubRepository.ps1 b/src/functions/public/Repositories/Repositories/Get-GitHubRepository.ps1 index 0f400433..a9244278 100644 --- a/src/functions/public/Repositories/Repositories/Get-GitHubRepository.ps1 +++ b/src/functions/public/Repositories/Repositories/Get-GitHubRepository.ps1 @@ -192,7 +192,9 @@ filter Get-GitHubRepository { PerPage = $PerPage Since = $Since Before = $Before - } | Remove-HashtableEntry -NullOrEmptyValues + } + $params | Remove-HashtableEntry -NullOrEmptyValues + Write-Verbose ($params | Format-List | Out-String) Get-GitHubMyRepositories @params } 'MyRepos_Aff-Vis' { @@ -205,7 +207,9 @@ filter Get-GitHubRepository { PerPage = $PerPage Since = $Since Before = $Before - } | Remove-HashtableEntry -NullOrEmptyValues + } + $params | Remove-HashtableEntry -NullOrEmptyValues + Write-Verbose ($params | Format-List | Out-String) Get-GitHubMyRepositories @params } 'ByName' { @@ -213,14 +217,18 @@ filter Get-GitHubRepository { Context = $Context Owner = $Owner Repo = $Repo - } | Remove-HashtableEntry -NullOrEmptyValues + } + $params | Remove-HashtableEntry -NullOrEmptyValues + Write-Verbose ($params | Format-List | Out-String) Get-GitHubRepositoryByName @params } 'ListByID' { $params = @{ Context = $Context Since = $SinceID - } | Remove-HashtableEntry -NullOrEmptyValues + } + $params | Remove-HashtableEntry -NullOrEmptyValues + Write-Verbose ($params | Format-List | Out-String) Get-GitHubRepositoryListByID @params } 'ListByOrg' { @@ -231,7 +239,9 @@ filter Get-GitHubRepository { Sort = $Sort Direction = $Direction PerPage = $PerPage - } | Remove-HashtableEntry -NullOrEmptyValues + } + $params | Remove-HashtableEntry -NullOrEmptyValues + Write-Verbose ($params | Format-List | Out-String) Get-GitHubRepositoryListByOrg @params } 'ListByUser' { @@ -242,7 +252,9 @@ filter Get-GitHubRepository { Sort = $Sort Direction = $Direction PerPage = $PerPage - } | Remove-HashtableEntry -NullOrEmptyValues + } + $params | Remove-HashtableEntry -NullOrEmptyValues + Write-Verbose ($params | Format-List | Out-String) Get-GitHubRepositoryListByUser @params } } From f7a6536a7708b095411ac94890cf188b56e1ed19 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Mon, 16 Dec 2024 09:19:57 +0100 Subject: [PATCH 24/24] Add PSModule initialization step to coverage report workflow --- .github/workflows/Set-CoverageReport.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/Set-CoverageReport.yml b/.github/workflows/Set-CoverageReport.yml index 46583707..e7f5c295 100644 --- a/.github/workflows/Set-CoverageReport.yml +++ b/.github/workflows/Set-CoverageReport.yml @@ -16,6 +16,9 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 + - name: Initialize-PSModule + uses: PSModule/Initialize-PSModule@v1 + - name: Update coverage report uses: PSModule/GitHub-Script@v1 with: