Skip to content

Commit c941a8d

Browse files
committed
20220702B
1 parent db9d341 commit c941a8d

File tree

1 file changed

+11
-2
lines changed
  • hugoalh.GitHubActionsToolkit/module

1 file changed

+11
-2
lines changed

hugoalh.GitHubActionsToolkit/module/log.psm1

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Function Enter-LogGroup {
2828
[CmdletBinding(HelpUri = 'https://github.com/hugoalh-studio/ghactions-toolkit-powershell/wiki/api_function_enter-githubactionsloggroup#Enter-GitHubActionsLogGroup')]
2929
[OutputType([Void])]
3030
Param (
31-
[Parameter(Mandatory = $True, Position = 0)][ValidatePattern('^.+$', ErrorMessage = 'Parameter `Title` must be in single line string!')][Alias('Header', 'Message')][String]$Title
31+
[Parameter(Mandatory = $True, Position = 0)][ValidatePattern('^.+$', ErrorMessage = 'Parameter `Title` must be in single line string!')][Alias('Header')][String]$Title
3232
)
3333
Write-GitHubActionsCommand -Command 'group' -Value $Title
3434
}
@@ -272,23 +272,32 @@ GitHub Actions - Write Raw
272272
Print anything to the log without accidentally execute any commands.
273273
.PARAMETER InputObject
274274
Object that need to log.
275+
.PARAMETER GroupTitle
276+
Title of the log group; This creates an expandable group in the log, and anything are inside an expandable group in the log.
275277
.OUTPUTS
276278
[Void]
277279
#>
278280
Function Write-Raw {
279281
[CmdletBinding(HelpUri = 'https://github.com/hugoalh-studio/ghactions-toolkit-powershell/wiki/api_function_write-githubactionsraw#Write-GitHubActionsRaw')]
280282
[OutputType([Void])]
281283
Param (
282-
[Parameter(Mandatory = $True, Position = 0, ValueFromPipeline = $True)][AllowEmptyCollection()][AllowEmptyString()][AllowNull()][Alias('Content', 'Input', 'Message', 'Object')]$InputObject
284+
[Parameter(Mandatory = $True, Position = 0, ValueFromPipeline = $True)][AllowEmptyCollection()][AllowEmptyString()][AllowNull()][Alias('Content', 'Input', 'Message', 'Object')]$InputObject,
285+
[Alias('GroupHeader', 'Header', 'Title')][String]$GroupTitle = ''
283286
)
284287
Begin {
288+
If ($GroupTitle.Length -igt 0) {
289+
Enter-LogGroup -Title $GroupTitle
290+
}
285291
[String]$EndToken = Disable-GitHubActionsProcessingCommands
286292
}
287293
Process {
288294
Write-Host -Object $InputObject
289295
}
290296
End {
291297
Enable-GitHubActionsProcessingCommands -EndToken $EndToken
298+
If ($GroupTitle.Length -igt 0) {
299+
Exit-LogGroup
300+
}
292301
}
293302
}
294303
<#

0 commit comments

Comments
 (0)