Skip to content

Commit a291109

Browse files
committed
20220509C
1 parent 101cb44 commit a291109

File tree

1 file changed

+32
-2
lines changed

1 file changed

+32
-2
lines changed

hugoalh.GitHubActionsToolkit/hugoalh.GitHubActionsToolkit.psm1

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,22 @@ function Disable-GitHubActionsProcessingCommand {
281281
[CmdletBinding(HelpUri = 'https://github.com/hugoalh-studio/ghactions-toolkit-powershell/wiki/api_function_disable-githubactionsprocessingcommand#Disable-GitHubActionsProcessingCommand')]
282282
[OutputType([string])]
283283
param(
284-
[Parameter(Position = 0)][ValidatePattern('^.+$')][Alias('EndKey', 'EndValue', 'Key', 'Token', 'Value')][string]$EndToken = ((New-Guid).Guid -replace '-', '')
284+
[Parameter(Position = 0)][ValidateScript({
285+
return (($_ -match '^.+$') -and ($_.Length -ge 4) -and ($_ -inotin @(
286+
'add-mask',
287+
'add-matcher',
288+
'debug',
289+
'echo',
290+
'endgroup',
291+
'error',
292+
'group',
293+
'notice',
294+
'remove-matcher',
295+
'save-state',
296+
'set-output',
297+
'warning'
298+
)))
299+
})][Alias('EndKey', 'EndValue', 'Key', 'Token', 'Value')][string]$EndToken = ((New-Guid).Guid -replace '-', '')
285300
)
286301
Write-GitHubActionsCommand -Command 'stop-commands' -Message $EndToken
287302
return $EndToken
@@ -320,7 +335,22 @@ function Enable-GitHubActionsProcessingCommand {
320335
[CmdletBinding(HelpUri = 'https://github.com/hugoalh-studio/ghactions-toolkit-powershell/wiki/api_function_enable-githubactionsprocessingcommand#Enable-GitHubActionsProcessingCommand')]
321336
[OutputType([void])]
322337
param(
323-
[Parameter(Mandatory = $true, Position = 0)][ValidatePattern('^.+$')][Alias('EndKey', 'EndValue', 'Key', 'Token', 'Value')][string]$EndToken
338+
[Parameter(Mandatory = $true, Position = 0)][ValidateScript({
339+
return (($_ -match '^.+$') -and ($_.Length -ge 4) -and ($_ -inotin @(
340+
'add-mask',
341+
'add-matcher',
342+
'debug',
343+
'echo',
344+
'endgroup',
345+
'error',
346+
'group',
347+
'notice',
348+
'remove-matcher',
349+
'save-state',
350+
'set-output',
351+
'warning'
352+
)))
353+
})][Alias('EndKey', 'EndValue', 'Key', 'Token', 'Value')][string]$EndToken
324354
)
325355
return Write-GitHubActionsCommand -Command $EndToken
326356
}

0 commit comments

Comments
 (0)