|
2 | 2 | #Requires -Version 7.2
|
3 | 3 | <#
|
4 | 4 | .SYNOPSIS
|
5 |
| -GitHub Actions - Add Step Summary |
| 5 | +GitHub Actions - Add Step Summary (Raw) |
6 | 6 | .DESCRIPTION
|
7 |
| -Add some GitHub flavored Markdown for step so that it will be displayed on the summary page of a run; Can use to display and group unique content, such as test result summaries, so that viewing the result of a run does not need to go into the logs to see important information related to the run, such as failures. When a run's job finishes, the summaries for all steps in a job are grouped together into a single job summary and are shown on the run summary page. If multiple jobs generate summaries, the job summaries are ordered by job completion time. |
| 7 | +Add some GitHub flavored Markdown for step so that it will display on the summary page of a run; Can use to display and group unique content, such as test result summaries, so that viewing the result of a run does not need to go into the logs to see important information related to the run, such as failures. When a run's job finishes, the summaries for all steps in a job are grouped together into a single job summary and are shown on the run summary page. If multiple jobs generate summaries, the job summaries are ordered by job completion time. |
8 | 8 | .PARAMETER Value
|
9 | 9 | Content.
|
10 | 10 | .PARAMETER NoNewLine
|
@@ -34,6 +34,100 @@ Function Add-StepSummary {
|
34 | 34 | Return
|
35 | 35 | }
|
36 | 36 | }
|
| 37 | +Set-Alias -Name 'Add-StepSummaryRaw' -Value 'Add-StepSummary' -Option 'ReadOnly' -Scope 'Local' |
| 38 | +<# |
| 39 | +.SYNOPSIS |
| 40 | +GitHub Actions - Add Step Summary Image |
| 41 | +.DESCRIPTION |
| 42 | +Add some GitHub flavored Markdown image for step so that it will display on the summary page of a run. |
| 43 | +IMPORTANT: No support reference image! |
| 44 | +.PARAMETER Uri |
| 45 | +Image URI. |
| 46 | +.PARAMETER Title |
| 47 | +Image title. |
| 48 | +.PARAMETER AlternativeText |
| 49 | +Image alternative text. |
| 50 | +.PARAMETER Width |
| 51 | +Image width. |
| 52 | +.PARAMETER Height |
| 53 | +Image height. |
| 54 | +.PARAMETER NoNewLine |
| 55 | +Do not add a new line or carriage return to the content, the string representations of the input objects are concatenated to form the output, no spaces or newlines are inserted between the output strings, no newline is added after the last output string. |
| 56 | +#> |
| 57 | +Function Add-StepSummaryImage { |
| 58 | + [CmdletBinding(HelpUri = 'https://github.com/hugoalh-studio/ghactions-toolkit-powershell/wiki/api_function_add-githubactionsstepsummaryimage#Add-GitHubActionsStepSummaryImage')] |
| 59 | + [OutputType([Void])] |
| 60 | + Param ( |
| 61 | + [Parameter(Mandatory = $True, Position = 0)][Alias('Url')][String]$Uri, |
| 62 | + [String]$Title, |
| 63 | + [Alias('AltText')][String]$AlternativeText, |
| 64 | + [ValidateRange(0, [Int32]::MaxValue)][Int32]$Width = -1, |
| 65 | + [ValidateRange(0, [Int32]::MaxValue)][Int32]$Height = -1, |
| 66 | + [Switch]$NoNewLine |
| 67 | + ) |
| 68 | + If ( |
| 69 | + $Width -igt -1 -or |
| 70 | + $Height -igt -1 |
| 71 | + ) { |
| 72 | + [String]$ResultHtml = "<img src=`"$Uri`"" |
| 73 | + If ($Title.Length -igt 0) { |
| 74 | + $ResultHtml += " title=`"$Title`"" |
| 75 | + } |
| 76 | + If ($AlternativeText.Length -igt 0) { |
| 77 | + $ResultHtml += " alt=`"$AlternativeText`"" |
| 78 | + } |
| 79 | + If ($Width -igt -1) { |
| 80 | + $ResultHtml += " width=`"$Width`"" |
| 81 | + } |
| 82 | + If ($Height -igt -1) { |
| 83 | + $ResultHtml += " height=`"$Height`"" |
| 84 | + } |
| 85 | + $ResultHtml += '>' |
| 86 | + Return (Add-StepSummary -Value $ResultHtml -NoNewLine:$NoNewLine) |
| 87 | + } |
| 88 | + [String]$ResultMarkdown = " { |
| 90 | + $ResultMarkdown += " `"$Title`"" |
| 91 | + } |
| 92 | + $ResultMarkdown += ')' |
| 93 | + Return (Add-StepSummary -Value $ResultMarkdown -NoNewLine:$NoNewLine) |
| 94 | +} |
| 95 | +Set-Alias -Name 'Add-StepSummaryPicture' -Value 'Add-StepSummaryImage' -Option 'ReadOnly' -Scope 'Local' |
| 96 | +<# |
| 97 | +.SYNOPSIS |
| 98 | +GitHub Actions - Add Step Summary Link |
| 99 | +.DESCRIPTION |
| 100 | +Add some GitHub flavored Markdown link for step so that it will display on the summary page of a run. |
| 101 | +IMPORTANT: No support reference link! |
| 102 | +.PARAMETER Uri |
| 103 | +Image URI. |
| 104 | +.PARAMETER Title |
| 105 | +Image title. |
| 106 | +.PARAMETER AlternativeText |
| 107 | +Image alternative text. |
| 108 | +.PARAMETER Width |
| 109 | +Image width. |
| 110 | +.PARAMETER Height |
| 111 | +Image height. |
| 112 | +.PARAMETER NoNewLine |
| 113 | +Do not add a new line or carriage return to the content, the string representations of the input objects are concatenated to form the output, no spaces or newlines are inserted between the output strings, no newline is added after the last output string. |
| 114 | +#> |
| 115 | +Function Add-StepSummaryLink { |
| 116 | + [CmdletBinding(HelpUri = 'https://github.com/hugoalh-studio/ghactions-toolkit-powershell/wiki/api_function_add-githubactionsstepsummarylink#Add-GitHubActionsStepSummaryLink')] |
| 117 | + [OutputType([Void])] |
| 118 | + Param ( |
| 119 | + [Parameter(Mandatory = $True, Position = 0)][String]$Text, |
| 120 | + [Parameter(Mandatory = $True, Position = 1)][Alias('Url')][String]$Uri, |
| 121 | + [String]$Title |
| 122 | + ) |
| 123 | + [String]$ResultMarkdown = "[$Text]($Uri" |
| 124 | + If ($Title.Length -igt 0) { |
| 125 | + $ResultMarkdown += " `"$Title`"" |
| 126 | + } |
| 127 | + $ResultMarkdown += ')' |
| 128 | + Return (Add-StepSummary -Value $ResultMarkdown -NoNewLine:$NoNewLine) |
| 129 | +} |
| 130 | +Set-Alias -Name 'Add-StepSummaryHyperlink' -Value 'Add-StepSummaryLink' -Option 'ReadOnly' -Scope 'Local' |
37 | 131 | <#
|
38 | 132 | .SYNOPSIS
|
39 | 133 | GitHub Actions - Get Step Summary
|
@@ -81,7 +175,7 @@ Function Remove-StepSummary {
|
81 | 175 | .SYNOPSIS
|
82 | 176 | GitHub Actions - Set Step Summary
|
83 | 177 | .DESCRIPTION
|
84 |
| -Set some GitHub flavored Markdown for step so that it will be displayed on the summary page of a run; Can use to display and group unique content, such as test result summaries, so that viewing the result of a run does not need to go into the logs to see important information related to the run, such as failures. When a run's job finishes, the summaries for all steps in a job are grouped together into a single job summary and are shown on the run summary page. If multiple jobs generate summaries, the job summaries are ordered by job completion time. |
| 178 | +Set some GitHub flavored Markdown for step so that it will display on the summary page of a run; Can use to display and group unique content, such as test result summaries, so that viewing the result of a run does not need to go into the logs to see important information related to the run, such as failures. When a run's job finishes, the summaries for all steps in a job are grouped together into a single job summary and are shown on the run summary page. If multiple jobs generate summaries, the job summaries are ordered by job completion time. |
85 | 179 | .PARAMETER Value
|
86 | 180 | Content.
|
87 | 181 | .PARAMETER NoNewLine
|
@@ -113,7 +207,13 @@ Function Set-StepSummary {
|
113 | 207 | }
|
114 | 208 | Export-ModuleMember -Function @(
|
115 | 209 | 'Add-StepSummary',
|
| 210 | + 'Add-StepSummaryImage', |
| 211 | + 'Add-StepSummaryLink', |
116 | 212 | 'Get-StepSummary',
|
117 | 213 | 'Remove-StepSummary',
|
118 | 214 | 'Set-StepSummary'
|
| 215 | +) -Alias @( |
| 216 | + 'Add-StepSummaryHyperlink', |
| 217 | + 'Add-StepSummaryPicture', |
| 218 | + 'Add-StepSummaryRaw' |
119 | 219 | )
|
0 commit comments