Skip to content

Commit 5ec5b92

Browse files
🪲 [Fix]: Update git config even if not default context (#264)
## Description This pull request includes updates to the PowerShell scripts related to GitHub context and configuration settings. The most important changes include a fix to the `Set-GitHubContext` function and an update to the `Set-GitHubGitConfig` function to improve the clarity of the operation message. Changes to GitHub context management: * [`src/functions/private/Auth/Context/Set-GitHubContext.ps1`](diffhunk://#diff-600a257f8ea7acdd36413aef2daf597ab69dd5bb3c17ec7d6fed83e15f0af1d7R150-L153): Fixed the placement of a closing brace to ensure proper execution flow when setting the GitHub context and Git config. Changes to GitHub configuration settings: * [`src/functions/public/Git/Set-GitHubGitConfig.ps1`](diffhunk://#diff-9b7705b192d0886bb8d7c2ee853a341fee0be08850a23e15955110e7105c803bL59-R59): Updated the `ShouldProcess` message to include the username and installation name for better clarity. ## Type of change <!-- Use the check-boxes [x] on the options that are relevant. --> - [ ] 📖 [Docs] - [x] 🪲 [Fix] - [ ] 🩹 [Patch] - [ ] ⚠️ [Security fix] - [ ] 🚀 [Feature] - [ ] 🌟 [Breaking change] ## Checklist <!-- Use the check-boxes [x] on the options that are relevant. --> - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas
1 parent 695c1c9 commit 5ec5b92

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/functions/private/Auth/Context/Set-GitHubContext.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,9 @@ function Set-GitHubContext {
147147
Set-Context -ID "$($script:GitHub.Config.ID)/$($contextObj['Name'])" -Context $contextObj
148148
if ($Default) {
149149
Set-GitHubDefaultContext -Context $contextObj['Name']
150-
if ($contextObj['AuthType'] -eq 'IAT' -and $script:GitHub.EnvironmentType -eq 'GHA') {
151-
Set-GitHubGitConfig -Context $contextObj['Name']
152-
}
150+
}
151+
if ($contextObj['AuthType'] -eq 'IAT' -and $script:GitHub.EnvironmentType -eq 'GHA') {
152+
Set-GitHubGitConfig -Context $contextObj['Name']
153153
}
154154
if ($PassThru) {
155155
Get-GitHubContext -Context $($contextObj['Name'])

src/functions/public/Git/Set-GitHubGitConfig.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
$hostName = $Context.HostName
5757
$installationName = $Context.InstallationName
5858

59-
if ($PSCmdlet.ShouldProcess("$Name", 'Set Git configuration')) {
59+
if ($PSCmdlet.ShouldProcess("$username on $installationName", 'Set Git configuration')) {
6060
$git = 'git'
6161
@(
6262
@('config', '--local', 'user.name', "$username"),

0 commit comments

Comments
 (0)