Skip to content

Commit d9d6f76

Browse files
Refactor Action-Test workflow to improve Git configuration handling and output formatting
1 parent 2c3abeb commit d9d6f76

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

.github/workflows/Action-Test.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,22 +40,25 @@ jobs:
4040
$scopes = 'local', 'global', 'system'
4141
$scopes | ForEach-Object {
4242
LogGroup "GitConfig - $_" {
43-
$configList = git config --$_ --list 2>&1
43+
$Scope = $_
44+
$configList = git config --$Scope --list 2>&1
4445
if ($LASTEXITCODE -ne 0) {
4546
$global:LASTEXITCODE = 0
4647
$configList = $null
4748
} else {
4849
$config = @()
4950
$configList = $configList | Sort-Object
5051
$configList | ForEach-Object {
51-
$name, $value = $_ -split '='
52+
$name, $value = $_ -split '=', 2
53+
if ($value -match '(?i)AUTHORIZATION:\s*(?<scheme>[^\s]+)\s+(?<token>.*)') {
54+
$secret = $matches['token']
55+
Add-GitHubMask -Value $secret
56+
}
5257
$config += @{
53-
$name = $value
58+
($name.Trim()) = ($value.Trim())
5459
}
5560
}
56-
$config | ForEach-Object {
57-
$_.GetEnumerator()
58-
} | Format-List
61+
$config
5962
}
6063
}
6164
}

0 commit comments

Comments
 (0)