@@ -34,7 +34,7 @@ An internal function to validate environment variable.
34
34
. PARAMETER InputObject
35
35
Environment variable that need to validate.
36
36
. OUTPUTS
37
- Boolean -or Void
37
+ Boolean | Void
38
38
#>
39
39
function Test-GHActionsEnvironmentVariable {
40
40
[CmdletBinding ()]
@@ -70,7 +70,7 @@ function Write-GHActionsCommand {
70
70
[string ]$Result = " ::$Command "
71
71
if ($Properties.Count -gt 0 ) {
72
72
$Result += " $ ( $ ($Properties.GetEnumerator () | ForEach-Object - Process {
73
- " $ ( $_.Name ) =$ ( Format-GHActionsEscapeCharacters - InputObject $_.Value - Command) "
73
+ return " $ ( $_.Name ) =$ ( Format-GHActionsEscapeCharacters - InputObject $_.Value - Command) "
74
74
}) -join ' ,' ) "
75
75
}
76
76
$Result += " ::$ ( Format-GHActionsEscapeCharacters - InputObject $Message ) "
@@ -135,9 +135,9 @@ function Add-GHActionsEnvironmentVariable {
135
135
}
136
136
}
137
137
end {
138
- Add-Content - Encoding utf8NoBOM - Path $env: GITHUB_ENV - Value " $ ( $ ($Result.GetEnumerator () | ForEach-Object - Process {
139
- " $ ( $_.Name ) =$ ( $_.Value ) "
140
- }) -join " `n " ) "
138
+ Add-Content - Path $env: GITHUB_ENV - Value " $ ( $ ($Result.GetEnumerator () | ForEach-Object - Process {
139
+ return " $ ( $_.Name ) =$ ( $_.Value ) "
140
+ }) -join " `n " ) " - Encoding utf8NoBOM
141
141
}
142
142
}
143
143
<#
@@ -159,7 +159,7 @@ function Add-GHActionsPATH {
159
159
[string []]$Result = @ ()
160
160
}
161
161
process {
162
- $Path.GetEnumerator () | ForEach-Object - Process {
162
+ $Path | ForEach-Object - Process {
163
163
if (Test-Path - Path $_ - IsValid) {
164
164
$Result += $_
165
165
} else {
@@ -168,7 +168,7 @@ function Add-GHActionsPATH {
168
168
}
169
169
}
170
170
end {
171
- Add-Content - Encoding utf8NoBOM - Path $env: GITHUB_PATH - Value " $ ( $Result -join " `n " ) "
171
+ Add-Content - Path $env: GITHUB_PATH - Value " $ ( $Result -join " `n " ) " - Encoding utf8NoBOM
172
172
}
173
173
}
174
174
<#
@@ -292,7 +292,7 @@ Whether the input is require. If required and not present, will throw an error.
292
292
. PARAMETER Trim
293
293
Trim the input's value.
294
294
. OUTPUTS
295
- Hashtable -or String
295
+ Hashtable | String
296
296
#>
297
297
function Get-GHActionsInput {
298
298
[CmdletBinding ()]
@@ -305,7 +305,7 @@ function Get-GHActionsInput {
305
305
[hashtable ]$Result = @ {}
306
306
}
307
307
process {
308
- $Name.GetEnumerator () | ForEach-Object - Process {
308
+ $Name | ForEach-Object - Process {
309
309
$InputValue = Get-ChildItem - Path " Env:\INPUT_$ ( $_.ToUpper () -replace ' [ \n\r]' , ' _' ) " - ErrorAction SilentlyContinue
310
310
if ($InputValue -eq $null ) {
311
311
if ($Require ) {
@@ -354,7 +354,7 @@ Name of the state.
354
354
. PARAMETER Trim
355
355
Trim the state's value.
356
356
. OUTPUTS
357
- Hashtable -or String
357
+ Hashtable | String
358
358
#>
359
359
function Get-GHActionsState {
360
360
[CmdletBinding ()]
@@ -366,7 +366,7 @@ function Get-GHActionsState {
366
366
[hashtable ]$Result = @ {}
367
367
}
368
368
process {
369
- $Name.GetEnumerator () | ForEach-Object - Process {
369
+ $Name | ForEach-Object - Process {
370
370
$StateValue = Get-ChildItem - Path " Env:\STATE_$ ( $_.ToUpper () -replace ' [ \n\r]' , ' _' ) " - ErrorAction SilentlyContinue
371
371
if ($StateValue -eq $null ) {
372
372
$Result [$_ ] = $StateValue
@@ -397,30 +397,7 @@ PSCustomObject
397
397
function Get-GHActionsWebhookEventPayload {
398
398
[CmdletBinding ()]
399
399
param ()
400
- return (Get-Content - Encoding utf8NoBOM - Path $env: GITHUB_EVENT_PATH - Raw | ConvertFrom-Json - Depth 100 )
401
- }
402
- <#
403
- . SYNOPSIS
404
- Execute script block in a log group.
405
- . PARAMETER Title
406
- Title of the log group.
407
- . PARAMETER ScriptBlock
408
- Script block to execute in the log group.
409
- . OUTPUTS
410
- Any
411
- #>
412
- function Invoke-GHActionsScriptGroup {
413
- [CmdletBinding ()]
414
- param (
415
- [Parameter (Mandatory = $true , Position = 0 )][string ]$Title ,
416
- [Parameter (Mandatory = $true , Position = 1 )][scriptblock ]$ScriptBlock
417
- )
418
- Enter-GHActionsLogGroup - Title $Title
419
- try {
420
- return $ScriptBlock.Invoke ()
421
- } finally {
422
- Exit-GHActionsLogGroup
423
- }
400
+ return (Get-Content - Path $env: GITHUB_EVENT_PATH - Raw - Encoding utf8NoBOM | ConvertFrom-Json - Depth 100 )
424
401
}
425
402
<#
426
403
. SYNOPSIS
@@ -440,7 +417,7 @@ function Set-GHActionsOutput {
440
417
[Parameter (Mandatory = $true , Position = 0 )][string ]$Name ,
441
418
[Parameter (Mandatory = $true , Position = 1 )][string ]$Value
442
419
)
443
- Write-GHActionsCommand - Command ' set-output' - Message $Value - Properties @ {' name' = $Name }
420
+ Write-GHActionsCommand - Command ' set-output' - Message $Value - Properties @ { ' name' = $Name }
444
421
}
445
422
<#
446
423
. SYNOPSIS
@@ -460,7 +437,7 @@ function Set-GHActionsState {
460
437
[Parameter (Mandatory = $true , Position = 0 )][string ]$Name ,
461
438
[Parameter (Mandatory = $true , Position = 1 )][string ]$Value
462
439
)
463
- Write-GHActionsCommand - Command ' save-state' - Message $Value - Properties @ {' name' = $Name }
440
+ Write-GHActionsCommand - Command ' save-state' - Message $Value - Properties @ { ' name' = $Name }
464
441
}
465
442
<#
466
443
. SYNOPSIS
@@ -678,4 +655,4 @@ function Write-GHActionsWarning {
678
655
}
679
656
end {}
680
657
}
681
- Export-ModuleMember - Function Add-GHActionsEnvironmentVariable , Add-GHActionsPATH , Add-GHActionsSecretMask , Disable-GHActionsCommandEcho , Disable-GHActionsProcessingCommand , Enable-GHActionsCommandEcho , Enable-GHActionsProcessingCommand , Enter-GHActionsLogGroup , Exit-GHActionsLogGroup , Get-GHActionsInput , Get-GHActionsIsDebug , Get-GHActionsState , Get-GHActionsWebhookEventPayload , Invoke-GHActionsScriptGroup , Set-GHActionsOutput , Set-GHActionsState , Write-GHActionsDebug , Write-GHActionsError , Write-GHActionsFail , Write-GHActionsNotice , Write-GHActionsWarning
658
+ Export-ModuleMember - Function Add-GHActionsEnvironmentVariable , Add-GHActionsPATH , Add-GHActionsSecretMask , Disable-GHActionsCommandEcho , Disable-GHActionsProcessingCommand , Enable-GHActionsCommandEcho , Enable-GHActionsProcessingCommand , Enter-GHActionsLogGroup , Exit-GHActionsLogGroup , Get-GHActionsInput , Get-GHActionsIsDebug , Get-GHActionsState , Get-GHActionsWebhookEventPayload , Set-GHActionsOutput , Set-GHActionsState , Write-GHActionsDebug , Write-GHActionsError , Write-GHActionsFail , Write-GHActionsNotice , Write-GHActionsWarning
0 commit comments