Skip to content

Commit 128418e

Browse files
🚀 [Refactor]: Initialize contextParamList as an array and update context parameter handling for improved clarity and performance in Connect-GitHubApp.
1 parent 91ce75f commit 128418e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@
158158
Write-Verbose "Found [$($selectedInstallations.Count)] installations for the target."
159159
$moduleName = $script:Module.Name
160160
$moduleVersion = $script:PSModuleInfo.ModuleVersion
161+
$contextParamList = , @()
161162
$contextParamList = $selectedInstallations | ForEach-Object -ThrottleLimit $ThrottleLimit -Parallel {
162163
Import-Module -Name $using:moduleName -RequiredVersion $using:moduleVersion -Force -ErrorAction Stop
163164
$installation = $_
@@ -196,7 +197,7 @@
196197
$contextParams['Enterprise'] = [string]$installation.Target.Name
197198
}
198199
}
199-
[pscustomobject]$contextParams
200+
$contextParams
200201
}
201202
foreach ($contextParams in $contextParamList) {
202203
$null = $contextObjects.Add($contextParams)
@@ -208,7 +209,7 @@
208209
foreach ($contextParams in $contextObjects) {
209210
Write-Verbose 'Logging in using a managed installation access token...'
210211
$contextParams | Format-Table | Out-String -Stream | ForEach-Object { Write-Verbose $_ }
211-
$contextObj = [GitHubAppInstallationContext]::new((Set-GitHubContext -Context $contextParams -PassThru -Default:$Default))
212+
$contextObj = [GitHubAppInstallationContext]::new((Set-GitHubContext -Context $contextParams.Clone() -PassThru -Default:$Default))
212213
$contextObj | Format-List | Out-String -Stream | ForEach-Object { Write-Verbose $_ }
213214
if (-not $Silent) {
214215
$name = $contextObj.Name

0 commit comments

Comments
 (0)