@@ -579,16 +579,10 @@ function Get-GitHubActionsInput {
579579 [OutputType ([string ], ParameterSetName = ' one' )]
580580 [OutputType ([hashtable ], ParameterSetName = (' all' , ' prefix' , ' suffix' ))]
581581 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 ,
585583 [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 ,
592586 [Parameter (ParameterSetName = ' all' )][switch ]$All ,
593587 [switch ]$Trim
594588 )
@@ -609,7 +603,7 @@ function Get-GitHubActionsInput {
609603 break
610604 }
611605 ' one' {
612- $InputValue = Get-ChildItem - LiteralPath " Env:\INPUT_$Name " - ErrorAction ' SilentlyContinue'
606+ $InputValue = Get-ChildItem - LiteralPath " Env:\INPUT_$ ( $ Name.ToUpper () ) " - ErrorAction ' SilentlyContinue'
613607 if ($null -eq $InputValue ) {
614608 if ($Require ) {
615609 return Write-GitHubActionsFail - Message " Input `` $Name `` is not defined!"
@@ -622,7 +616,7 @@ function Get-GitHubActionsInput {
622616 return $InputValue.Value
623617 }
624618 ' prefix' {
625- Get-ChildItem - Path " Env:\INPUT_$NamePrefix *" | ForEach-Object - Process {
619+ Get-ChildItem - Path " Env:\INPUT_$ ( $ NamePrefix.ToUpper () ) *" | ForEach-Object - Process {
626620 [string ]$InputKey = $_.Name -replace " ^INPUT_$ ( [regex ]::Escape($NamePrefix )) " , ' '
627621 if ($Trim ) {
628622 $OutputObject [$InputKey ] = $_.Value.Trim ()
@@ -633,7 +627,7 @@ function Get-GitHubActionsInput {
633627 break
634628 }
635629 ' suffix' {
636- Get-ChildItem - Path " Env:\INPUT_*$NameSuffix " | ForEach-Object - Process {
630+ Get-ChildItem - Path " Env:\INPUT_*$ ( $ NameSuffix.ToUpper () ) " | ForEach-Object - Process {
637631 [string ]$InputKey = $_.Name -replace " ^INPUT_|$ ( [regex ]::Escape($NameSuffix )) $" , ' '
638632 if ($Trim ) {
639633 $OutputObject [$InputKey ] = $_.Value.Trim ()
@@ -693,15 +687,9 @@ function Get-GitHubActionsState {
693687 [OutputType ([string ], ParameterSetName = ' one' )]
694688 [OutputType ([hashtable ], ParameterSetName = (' all' , ' prefix' , ' suffix' ))]
695689 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 ,
705693 [Parameter (ParameterSetName = ' all' )][switch ]$All ,
706694 [switch ]$Trim
707695 )
@@ -722,7 +710,7 @@ function Get-GitHubActionsState {
722710 break
723711 }
724712 ' one' {
725- $StateValue = Get-ChildItem - LiteralPath " Env:\STATE_$Name " - ErrorAction ' SilentlyContinue'
713+ $StateValue = Get-ChildItem - LiteralPath " Env:\STATE_$ ( $ Name.ToUpper () ) " - ErrorAction ' SilentlyContinue'
726714 if ($null -eq $StateValue ) {
727715 return $null
728716 }
@@ -732,7 +720,7 @@ function Get-GitHubActionsState {
732720 return $StateValue.Value
733721 }
734722 ' prefix' {
735- Get-ChildItem - Path " Env:\STATE_$NamePrefix *" | ForEach-Object - Process {
723+ Get-ChildItem - Path " Env:\STATE_$ ( $ NamePrefix.ToUpper () ) *" | ForEach-Object - Process {
736724 [string ]$StateKey = $_.Name -replace " ^STATE_$ ( [regex ]::Escape($NamePrefix )) " , ' '
737725 if ($Trim ) {
738726 $OutputObject [$StateKey ] = $_.Value.Trim ()
@@ -743,7 +731,7 @@ function Get-GitHubActionsState {
743731 break
744732 }
745733 ' suffix' {
746- Get-ChildItem - Path " Env:\STATE_*$NameSuffix " | ForEach-Object - Process {
734+ Get-ChildItem - Path " Env:\STATE_*$ ( $ NameSuffix.ToUpper () ) " | ForEach-Object - Process {
747735 [string ]$StateKey = $_.Name -replace " ^STATE_|$ ( [regex ]::Escape($NameSuffix )) $" , ' '
748736 if ($Trim ) {
749737 $OutputObject [$StateKey ] = $_.Value.Trim ()
0 commit comments