From b64a59dbc4170db468495eee4e0ad36334e788bd Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Fri, 13 Dec 2024 15:34:03 +0100 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Refactor=20Get-Gi?= =?UTF-8?q?tHubAppByName=20function=20for=20improved=20context=20handling?= =?UTF-8?q?=20and=20logging?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../private/Apps/Get-GitHubAppByName.ps1 | 27 +++++++++++++------ 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/src/functions/private/Apps/Get-GitHubAppByName.ps1 b/src/functions/private/Apps/Get-GitHubAppByName.ps1 index 83ce4356..dacaa47a 100644 --- a/src/functions/private/Apps/Get-GitHubAppByName.ps1 +++ b/src/functions/private/Apps/Get-GitHubAppByName.ps1 @@ -30,15 +30,26 @@ [object] $Context = (Get-GitHubContext) ) - $Context = Resolve-GitHubContext -Context $Context - - $inputObject = @{ - Context = $Context - APIEndpoint = "/apps/$AppSlug" - Method = 'GET' + begin { + $commandName = $MyInvocation.MyCommand.Name + Write-Verbose "[$commandName] - Start" + $Context = Resolve-GitHubContext -Context $Context + Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT } - Invoke-GitHubAPI @inputObject | ForEach-Object { - Write-Output $_.Response + process { + + $inputObject = @{ + Context = $Context + APIEndpoint = "/apps/$AppSlug" + Method = 'GET' + } + + Invoke-GitHubAPI @inputObject | ForEach-Object { + Write-Output $_.Response + } + } + end { + Write-Verbose "[$commandName] - End" } } From 02ed8b301a180d461a20b51daf8f6872a55c3367 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Fri, 13 Dec 2024 22:13:03 +0100 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Remove=20unnecess?= =?UTF-8?q?ary=20blank=20line=20in=20Get-GitHubAppByName=20function?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/functions/private/Apps/Get-GitHubAppByName.ps1 | 1 - 1 file changed, 1 deletion(-) diff --git a/src/functions/private/Apps/Get-GitHubAppByName.ps1 b/src/functions/private/Apps/Get-GitHubAppByName.ps1 index dacaa47a..cf9ac29d 100644 --- a/src/functions/private/Apps/Get-GitHubAppByName.ps1 +++ b/src/functions/private/Apps/Get-GitHubAppByName.ps1 @@ -38,7 +38,6 @@ } process { - $inputObject = @{ Context = $Context APIEndpoint = "/apps/$AppSlug"