@@ -579,16 +579,10 @@ function Get-GitHubActionsInput {
579
579
[OutputType ([string ], ParameterSetName = ' one' )]
580
580
[OutputType ([hashtable ], ParameterSetName = (' all' , ' prefix' , ' suffix' ))]
581
581
param (
582
- [Parameter (Mandatory = $true , ParameterSetName = ' one' , Position = 0 , ValueFromPipeline = $true )][ValidateScript ({
583
- return (($_ -match ' ^.+$' ) -and ([WildcardPattern ]::ContainsWildcardCharacters($_ ) -eq $false ))
584
- })][Alias (' Key' )][string ]$Name ,
582
+ [Parameter (Mandatory = $true , ParameterSetName = ' one' , Position = 0 , ValueFromPipeline = $true )][ValidatePattern (' ^(?:[\da-z][\da-z_-]*)?[\da-z]$' )][Alias (' Key' )][string ]$Name ,
585
583
[Parameter (ParameterSetName = ' one' )][Alias (' Force' , ' Forced' , ' Required' )][switch ]$Require ,
586
- [Parameter (Mandatory = $true , ParameterSetName = ' prefix' )][ValidateScript ({
587
- return (($_ -match ' ^.+$' ) -and ([WildcardPattern ]::ContainsWildcardCharacters($_ ) -eq $false ))
588
- })][Alias (' KeyPrefix' , ' KeyStartWith' , ' NameStartWith' , ' Prefix' , ' PrefixKey' , ' PrefixName' , ' StartWith' , ' StartWithKey' , ' StartWithName' )][string ]$NamePrefix ,
589
- [Parameter (Mandatory = $true , ParameterSetName = ' suffix' )][ValidateScript ({
590
- return (($_ -match ' ^.+$' ) -and ([WildcardPattern ]::ContainsWildcardCharacters($_ ) -eq $false ))
591
- })][Alias (' EndWith' , ' EndWithKey' , ' EndWithName' , ' KeyEndWith' , ' KeySuffix' , ' NameEndWith' , ' Suffix' , ' SuffixKey' , ' SuffixName' )][string ]$NameSuffix ,
584
+ [Parameter (Mandatory = $true , ParameterSetName = ' prefix' )][ValidatePattern (' ^[\da-z][\da-z_-]*$' )][Alias (' KeyPrefix' , ' KeyStartWith' , ' NameStartWith' , ' Prefix' , ' PrefixKey' , ' PrefixName' , ' StartWith' , ' StartWithKey' , ' StartWithName' )][string ]$NamePrefix ,
585
+ [Parameter (Mandatory = $true , ParameterSetName = ' suffix' )][ValidatePattern (' ^[\da-z_-]*[\da-z]$' )][Alias (' EndWith' , ' EndWithKey' , ' EndWithName' , ' KeyEndWith' , ' KeySuffix' , ' NameEndWith' , ' Suffix' , ' SuffixKey' , ' SuffixName' )][string ]$NameSuffix ,
592
586
[Parameter (ParameterSetName = ' all' )][switch ]$All ,
593
587
[switch ]$Trim
594
588
)
@@ -609,7 +603,7 @@ function Get-GitHubActionsInput {
609
603
break
610
604
}
611
605
' one' {
612
- $InputValue = Get-ChildItem - LiteralPath " Env:\INPUT_$Name " - ErrorAction ' SilentlyContinue'
606
+ $InputValue = Get-ChildItem - LiteralPath " Env:\INPUT_$ ( $ Name.ToUpper () ) " - ErrorAction ' SilentlyContinue'
613
607
if ($null -eq $InputValue ) {
614
608
if ($Require ) {
615
609
return Write-GitHubActionsFail - Message " Input `` $Name `` is not defined!"
@@ -622,7 +616,7 @@ function Get-GitHubActionsInput {
622
616
return $InputValue.Value
623
617
}
624
618
' prefix' {
625
- Get-ChildItem - Path " Env:\INPUT_$NamePrefix *" | ForEach-Object - Process {
619
+ Get-ChildItem - Path " Env:\INPUT_$ ( $ NamePrefix.ToUpper () ) *" | ForEach-Object - Process {
626
620
[string ]$InputKey = $_.Name -replace " ^INPUT_$ ( [regex ]::Escape($NamePrefix )) " , ' '
627
621
if ($Trim ) {
628
622
$OutputObject [$InputKey ] = $_.Value.Trim ()
@@ -633,7 +627,7 @@ function Get-GitHubActionsInput {
633
627
break
634
628
}
635
629
' suffix' {
636
- Get-ChildItem - Path " Env:\INPUT_*$NameSuffix " | ForEach-Object - Process {
630
+ Get-ChildItem - Path " Env:\INPUT_*$ ( $ NameSuffix.ToUpper () ) " | ForEach-Object - Process {
637
631
[string ]$InputKey = $_.Name -replace " ^INPUT_|$ ( [regex ]::Escape($NameSuffix )) $" , ' '
638
632
if ($Trim ) {
639
633
$OutputObject [$InputKey ] = $_.Value.Trim ()
@@ -693,15 +687,9 @@ function Get-GitHubActionsState {
693
687
[OutputType ([string ], ParameterSetName = ' one' )]
694
688
[OutputType ([hashtable ], ParameterSetName = (' all' , ' prefix' , ' suffix' ))]
695
689
param (
696
- [Parameter (Mandatory = $true , ParameterSetName = ' one' , Position = 0 , ValueFromPipeline = $true )][ValidateScript ({
697
- return (($_ -match ' ^.+$' ) -and ([WildcardPattern ]::ContainsWildcardCharacters($_ ) -eq $false ))
698
- })][Alias (' Key' )][string ]$Name ,
699
- [Parameter (Mandatory = $true , ParameterSetName = ' prefix' )][ValidateScript ({
700
- return (($_ -match ' ^.+$' ) -and ([WildcardPattern ]::ContainsWildcardCharacters($_ ) -eq $false ))
701
- })][Alias (' KeyPrefix' , ' KeyStartWith' , ' NameStartWith' , ' Prefix' , ' PrefixKey' , ' PrefixName' , ' StartWith' , ' StartWithKey' , ' StartWithName' )][string ]$NamePrefix ,
702
- [Parameter (Mandatory = $true , ParameterSetName = ' suffix' )][ValidateScript ({
703
- return (($_ -match ' ^.+$' ) -and ([WildcardPattern ]::ContainsWildcardCharacters($_ ) -eq $false ))
704
- })][Alias (' EndWith' , ' EndWithKey' , ' EndWithName' , ' KeyEndWith' , ' KeySuffix' , ' NameEndWith' , ' Suffix' , ' SuffixKey' , ' SuffixName' )][string ]$NameSuffix ,
690
+ [Parameter (Mandatory = $true , ParameterSetName = ' one' , Position = 0 , ValueFromPipeline = $true )][ValidatePattern (' ^(?:[\da-z][\da-z_-]*)?[\da-z]$' )][Alias (' Key' )][string ]$Name ,
691
+ [Parameter (Mandatory = $true , ParameterSetName = ' prefix' )][ValidatePattern (' ^[\da-z][\da-z_-]*$' )][Alias (' KeyPrefix' , ' KeyStartWith' , ' NameStartWith' , ' Prefix' , ' PrefixKey' , ' PrefixName' , ' StartWith' , ' StartWithKey' , ' StartWithName' )][string ]$NamePrefix ,
692
+ [Parameter (Mandatory = $true , ParameterSetName = ' suffix' )][ValidatePattern (' ^[\da-z_-]*[\da-z]$' )][Alias (' EndWith' , ' EndWithKey' , ' EndWithName' , ' KeyEndWith' , ' KeySuffix' , ' NameEndWith' , ' Suffix' , ' SuffixKey' , ' SuffixName' )][string ]$NameSuffix ,
705
693
[Parameter (ParameterSetName = ' all' )][switch ]$All ,
706
694
[switch ]$Trim
707
695
)
@@ -722,7 +710,7 @@ function Get-GitHubActionsState {
722
710
break
723
711
}
724
712
' one' {
725
- $StateValue = Get-ChildItem - LiteralPath " Env:\STATE_$Name " - ErrorAction ' SilentlyContinue'
713
+ $StateValue = Get-ChildItem - LiteralPath " Env:\STATE_$ ( $ Name.ToUpper () ) " - ErrorAction ' SilentlyContinue'
726
714
if ($null -eq $StateValue ) {
727
715
return $null
728
716
}
@@ -732,7 +720,7 @@ function Get-GitHubActionsState {
732
720
return $StateValue.Value
733
721
}
734
722
' prefix' {
735
- Get-ChildItem - Path " Env:\STATE_$NamePrefix *" | ForEach-Object - Process {
723
+ Get-ChildItem - Path " Env:\STATE_$ ( $ NamePrefix.ToUpper () ) *" | ForEach-Object - Process {
736
724
[string ]$StateKey = $_.Name -replace " ^STATE_$ ( [regex ]::Escape($NamePrefix )) " , ' '
737
725
if ($Trim ) {
738
726
$OutputObject [$StateKey ] = $_.Value.Trim ()
@@ -743,7 +731,7 @@ function Get-GitHubActionsState {
743
731
break
744
732
}
745
733
' suffix' {
746
- Get-ChildItem - Path " Env:\STATE_*$NameSuffix " | ForEach-Object - Process {
734
+ Get-ChildItem - Path " Env:\STATE_*$ ( $ NameSuffix.ToUpper () ) " | ForEach-Object - Process {
747
735
[string ]$StateKey = $_.Name -replace " ^STATE_|$ ( [regex ]::Escape($NameSuffix )) $" , ' '
748
736
if ($Trim ) {
749
737
$OutputObject [$StateKey ] = $_.Value.Trim ()
0 commit comments