Skip to content

Commit f1b7971

Browse files
🚀 [Refactor]: Update context handling in Connect-GitHubApp and simplify logout message in Disconnect-GitHubAccount for improved clarity and maintainability.
1 parent 7c54765 commit f1b7971

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@
161161
Import-Module -Name $using:moduleName -RequiredVersion $using:moduleVersion -Force -ErrorAction Stop
162162
$installation = $_
163163
Write-Verbose "Processing installation [$($installation.Target.Name)] [$($installation.id)]"
164-
$token = New-GitHubAppInstallationAccessToken -Context $Context -ID $installation.id
164+
$token = New-GitHubAppInstallationAccessToken -Context $using:Context -ID $installation.id
165165

166166
$contextParams = @{
167167
AuthType = [string]'IAT'
@@ -200,7 +200,7 @@
200200
$contextParams = $_.Clone()
201201
Write-Verbose 'Logging in using a managed installation access token...'
202202
$contextParams | Format-Table | Out-String -Stream | ForEach-Object { Write-Verbose $_ }
203-
$contextObj = [GitHubAppInstallationContext]::new((Set-GitHubContext -Context $contextParams -PassThru -Default:$Default))
203+
$contextObj = [GitHubAppInstallationContext]::new((Set-GitHubContext -Context $contextParams -PassThru -Default:$using:Default))
204204
$contextObj | Format-List | Out-String -Stream | ForEach-Object { Write-Verbose $_ }
205205
if (-not $Silent) {
206206
$name = $contextObj.Name

‎src/functions/public/Auth/Disconnect-GitHubAccount.ps1‎

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,9 @@
9393
}
9494

9595
if (-not $Silent) {
96-
if ($script:IsGitHubActions) {
97-
$green = $PSStyle.Foreground.Green
98-
$reset = $PSStyle.Reset
99-
Write-Host "$green✓$reset Logged out of GitHub! [$contextItem]"
100-
} else {
101-
Write-Host '✓ ' -ForegroundColor Green -NoNewline
102-
Write-Host "Logged out of GitHub! [$contextItem]"
103-
}
96+
$green = $PSStyle.Foreground.Green
97+
$reset = $PSStyle.Reset
98+
Write-Host "$green✓$reset Logged out of GitHub! [$contextItem]"
10499
}
105100
}
106101
}

0 commit comments

Comments
 (0)