Skip to content

Commit be2966a

Browse files
🚀 [Refactor]: Simplify contextParamList initialization and improve context parameter handling in Connect-GitHubApp for enhanced performance.
1 parent ee70b56 commit be2966a

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

‎src/functions/public/Auth/Connect-GitHubApp.ps1‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,7 @@
158158
Write-Verbose "Found [$($selectedInstallations.Count)] installations for the target."
159159
$moduleName = $script:Module.Name
160160
$moduleVersion = $script:PSModuleInfo.ModuleVersion
161-
$contextParamList = , @()
162-
$contextParamList += $selectedInstallations | ForEach-Object -ThrottleLimit $ThrottleLimit -Parallel {
161+
$contextParamList = $selectedInstallations | ForEach-Object -ThrottleLimit $ThrottleLimit -Parallel {
163162
Import-Module -Name $using:moduleName -RequiredVersion $using:moduleVersion -Force -ErrorAction Stop
164163
$installation = $_
165164
Write-Verbose "Processing installation [$($installation.Target.Name)] [$($installation.id)]"
@@ -197,7 +196,7 @@
197196
$contextParams['Enterprise'] = [string]$installation.Target.Name
198197
}
199198
}
200-
$contextParams
199+
[pscustomobject]$contextParams
201200
}
202201
$contextObjects.AddRange($contextParamList)
203202
$null = $selectedInstallations.Clear()
@@ -207,7 +206,7 @@
207206
foreach ($contextParams in $contextObjects) {
208207
Write-Verbose 'Logging in using a managed installation access token...'
209208
$contextParams | Format-Table | Out-String -Stream | ForEach-Object { Write-Verbose $_ }
210-
$contextObj = [GitHubAppInstallationContext]::new((Set-GitHubContext -Context $contextParams.Clone() -PassThru -Default:$Default))
209+
$contextObj = [GitHubAppInstallationContext]::new((Set-GitHubContext -Context $contextParams -PassThru -Default:$Default))
211210
$contextObj | Format-List | Out-String -Stream | ForEach-Object { Write-Verbose $_ }
212211
if (-not $Silent) {
213212
$name = $contextObj.Name

0 commit comments

Comments
 (0)