Skip to content

Commit

Permalink
Refactor Set-GitHubContext to use direct assignment for context prope…
Browse files Browse the repository at this point in the history
…rties
  • Loading branch information
MariusStorhaug committed Dec 12, 2024
1 parent 7b9dc45 commit ae24721
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions src/functions/public/Auth/Context/Set-GitHubContext.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -90,18 +90,16 @@ function Set-GitHubContext {
'App' {
$app = Get-GitHubApp -Context $Context
$ContextName = "$($Context['HostName'])/$($app.slug)"
$Context += @{
Name = $ContextName
DisplayName = [string]$app.name
Username = [string]$app.slug
NodeID = [string]$app.node_id
DatabaseID = [string]$app.id
Permissions = [string]$app.permissions
Events = [string]$app.events
OwnerName = [string]$app.owner.login
OwnerType = [string]$app.owner.type
Type = 'App'
}
$Context['Name'] = $ContextName
$Context['DisplayName'] = [string]$app.name
$Context['Username'] = [string]$app.slug
$Context['NodeID'] = [string]$app.node_id
$Context['DatabaseID'] = [string]$app.id
$Context['Permissions'] = [string]$app.permissions
$Context['Events'] = [string]$app.events
$Context['OwnerName'] = [string]$app.owner.login
$Context['OwnerType'] = [string]$app.owner.type
$Context['Type'] = 'App'
}
default {
throw 'Failed to get info on the context. Unknown logon type.'
Expand Down

0 comments on commit ae24721

Please sign in to comment.