Skip to content

Commit

Permalink
Improve default context retrieval in Get-GitHubContext function
Browse files Browse the repository at this point in the history
  • Loading branch information
MariusStorhaug committed Nov 24, 2024
1 parent 256b6f6 commit 7e5ca69
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/functions/public/Auth/Context/Get-GitHubContext.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ function Get-GitHubContext {
Write-Verbose "Getting available contexts for [$ID]"
} else {
$config = Get-GitHubConfig
$ID = $config.DefaultContext
if ([string]::IsNullOrEmpty($ID )) {
$defaultContext = $config.DefaultContext
$ID = "$($script:Config.Name)/$defaultContext"
if ([string]::IsNullOrEmpty($ID)) {
throw "No default GitHub context found. Please run 'Set-GitHubDefaultContext' or 'Connect-GitHub' to configure a GitHub context."
}
Write-Verbose "Getting the default context: [$ID]"
Expand Down

0 comments on commit 7e5ca69

Please sign in to comment.