Skip to content

Commit 60c76b3

Browse files
committed
20220129A
1 parent 1a07642 commit 60c76b3

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

hugoalh.GitHubActionsToolkit/hugoalh.GitHubActionsToolkit.psm1

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -346,11 +346,12 @@ function Get-GHActionsInput {
346346
'all' {
347347
$ResultIsHashtable = $true
348348
Get-ChildItem -Path 'Env:\' -Include 'INPUT_*' -Name | ForEach-Object -Process {
349-
$InputValue = Get-ChildItem -Path "Env:\$_"
349+
[string]$InputKey = $_ -replace '^INPUT_', ''
350+
[string]$InputValue = Get-ChildItem -Path "Env:\INPUT_$InputKey"
350351
if ($Trim) {
351-
$Result[$_] = $InputValue.Value.Trim()
352+
$Result[$InputKey] = $InputValue.Value.Trim()
352353
} else {
353-
$Result[$_] = $InputValue.Value
354+
$Result[$InputKey] = $InputValue.Value
354355
}
355356
}
356357
break
@@ -360,11 +361,12 @@ function Get-GHActionsInput {
360361
if ([WildcardPattern]::ContainsWildcardCharacters($_)) {
361362
$ResultIsHashtable = $true
362363
Get-ChildItem -Path 'Env:\' -Include "INPUT_$_" -Name | ForEach-Object -Process {
363-
$InputValue = Get-ChildItem -Path "Env:$_"
364+
[string]$InputKey = $_ -replace '^INPUT_', ''
365+
[string]$InputValue = Get-ChildItem -Path "Env:\INPUT_$InputKey"
364366
if ($Trim) {
365-
$Result[$_] = $InputValue.Value.Trim()
367+
$Result[$InputKey] = $InputValue.Value.Trim()
366368
} else {
367-
$Result[$_] = $InputValue.Value
369+
$Result[$InputKey] = $InputValue.Value
368370
}
369371
}
370372
} else {
@@ -440,11 +442,12 @@ function Get-GHActionsState {
440442
'all' {
441443
$ResultIsHashtable = $true
442444
Get-ChildItem -Path 'Env:\' -Include 'STATE_*' -Name | ForEach-Object -Process {
443-
$StateValue = Get-ChildItem -Path "Env:\$_"
445+
[string]$StateKey = $_ -replace '^STATE_', ''
446+
[string]$StateValue = Get-ChildItem -Path "Env:\STATE_$StateKey"
444447
if ($Trim) {
445-
$Result[$_] = $StateValue.Value.Trim()
448+
$Result[$StateKey] = $StateValue.Value.Trim()
446449
} else {
447-
$Result[$_] = $StateValue.Value
450+
$Result[$StateKey] = $StateValue.Value
448451
}
449452
}
450453
break
@@ -454,11 +457,12 @@ function Get-GHActionsState {
454457
if ([WildcardPattern]::ContainsWildcardCharacters($_)) {
455458
$ResultIsHashtable = $true
456459
Get-ChildItem -Path 'Env:\' -Include "STATE_$_" -Name | ForEach-Object -Process {
457-
$StateValue = Get-ChildItem -Path "Env:$_"
460+
[string]$StateKey = $_ -replace '^STATE_', ''
461+
[string]$StateValue = Get-ChildItem -Path "Env:\STATE_$StateKey"
458462
if ($Trim) {
459-
$Result[$_] = $StateValue.Value.Trim()
463+
$Result[$StateKey] = $StateValue.Value.Trim()
460464
} else {
461-
$Result[$_] = $StateValue.Value
465+
$Result[$StateKey] = $StateValue.Value
462466
}
463467
}
464468
} else {

0 commit comments

Comments
 (0)