From ae24721a79d7c9e57052fe158fccfa4b2b3911bf Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Thu, 12 Dec 2024 01:06:44 +0100 Subject: [PATCH] Refactor Set-GitHubContext to use direct assignment for context properties --- .../public/Auth/Context/Set-GitHubContext.ps1 | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/functions/public/Auth/Context/Set-GitHubContext.ps1 b/src/functions/public/Auth/Context/Set-GitHubContext.ps1 index 97c50350..927a1601 100644 --- a/src/functions/public/Auth/Context/Set-GitHubContext.ps1 +++ b/src/functions/public/Auth/Context/Set-GitHubContext.ps1 @@ -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.'