Skip to content

Commit 9af1bff

Browse files
committed
20220512A
1 parent 6bc5754 commit 9af1bff

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

hugoalh.GitHubActionsToolkit/hugoalh.GitHubActionsToolkit.psm1

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -771,16 +771,27 @@ GitHub Actions - Get Step Summary
771771
Get step summary that added/setted from functions `Add-GitHubActionsStepSummary` and `Set-GitHubActionsStepSummary`.
772772
.PARAMETER Raw
773773
Ignore newline characters and return the entire contents of a file in one string with the newlines preserved. By default, newline characters in a file are used as delimiters to separate the input into an array of strings.
774+
.PARAMETER Sizes
775+
Get step summary sizes instead of the content.
774776
.OUTPUTS
775-
String | String[]
777+
String | String[] | UInt
776778
#>
777779
function Get-GitHubActionsStepSummary {
778-
[CmdletBinding(HelpUri = 'https://github.com/hugoalh-studio/ghactions-toolkit-powershell/wiki/api_function_get-githubactionsstepsummary#Get-GitHubActionsStepSummary')]
779-
[OutputType(([string], [string[]]))]
780+
[CmdletBinding(DefaultParameterSetName = 'content', HelpUri = 'https://github.com/hugoalh-studio/ghactions-toolkit-powershell/wiki/api_function_get-githubactionsstepsummary#Get-GitHubActionsStepSummary')]
781+
[OutputType(([string], [string[]]), ParameterSetName = 'content')]
782+
[OutputType([uint], ParameterSetName = 'sizes')]
780783
param (
781-
[switch]$Raw
784+
[Parameter(ParameterSetName = 'content')][switch]$Raw,
785+
[Parameter(Mandatory = $true, ParameterSetName = 'sizes')][Alias('Size')][switch]$Sizes
782786
)
783-
return Get-Content -LiteralPath $env:GITHUB_STEP_SUMMARY -Raw:$Raw -Encoding 'UTF8NoBOM'
787+
switch ($PSCmdlet.ParameterSetName) {
788+
'content' {
789+
return Get-Content -LiteralPath $env:GITHUB_STEP_SUMMARY -Raw:$Raw -Encoding 'UTF8NoBOM'
790+
}
791+
'sizes' {
792+
return (Get-ChildItem -LiteralPath $env:GITHUB_STEP_SUMMARY).Length
793+
}
794+
}
784795
}
785796
Set-Alias -Name 'Get-GHActionsStepSummary' -Value 'Get-GitHubActionsStepSummary' -Option 'ReadOnly' -Scope 'Local'
786797
<#

0 commit comments

Comments
 (0)