Skip to content

Commit d63baf2

Browse files
committed
Fix weird enumerator issue
1 parent c941a8d commit d63baf2

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

hugoalh.GitHubActionsToolkit/module/environment-variable.psm1

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,20 +121,19 @@ Function Set-EnvironmentVariable {
121121
}
122122
End {
123123
If ($Result.Count -igt 0) {
124-
[PSCustomObject[]]$ResultEnumerator = $Result.GetEnumerator()
125124
Switch -Exact ($Scope.ToString() -isplit ', ') {
126125
'Current' {
127-
$ResultEnumerator | ForEach-Object -Process {
126+
$Result.GetEnumerator() | ForEach-Object -Process {
128127
[System.Environment]::SetEnvironmentVariable($_.Name, $_.Value) | Out-Null
129128
}
130129
}
131130
'Subsequent' {
132131
If ($Null -ieq $Env:GITHUB_ENV) {
133-
$ResultEnumerator | ForEach-Object -Process {
134-
Write-GitHubActionsCommand -Command 'set-env' -Parameter @{ 'name' = $Item.Name } -Value $Item.Value
132+
$Result.GetEnumerator() | ForEach-Object -Process {
133+
Write-GitHubActionsCommand -Command 'set-env' -Parameter @{ 'name' = $_.Name } -Value $_.Value
135134
}
136135
} Else {
137-
Add-Content -LiteralPath $Env:GITHUB_ENV -Value (($ResultEnumerator | ForEach-Object -Process {
136+
Add-Content -LiteralPath $Env:GITHUB_ENV -Value (($Result.GetEnumerator() | ForEach-Object -Process {
138137
Return "$($_.Name)=$($_.Value)"
139138
}) -join "`n") -Confirm:$False -Encoding 'UTF8NoBOM'
140139
}

0 commit comments

Comments
 (0)