Skip to content

Commit 908f49b

Browse files
committed
Add functions Add-StepSummaryHeader, Add-StepSummarySubscriptText and Add-StepSummarySuperscriptText
1 parent e96e9e0 commit 908f49b

File tree

3 files changed

+81
-12
lines changed

3 files changed

+81
-12
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,11 @@ Import-Module -Name 'hugoalh.GitHubActionsToolkit' -Prefix 'GitHubActions' -Scop
4848
- `Add-GitHubActionsProblemMatcher`
4949
- `Add-GitHubActionsSecretMask`
5050
- `Add-GitHubActionsStepSummary`
51+
- `Add-GitHubActionsStepSummaryHeader`
5152
- `Add-GitHubActionsStepSummaryImage`
5253
- `Add-GitHubActionsStepSummaryLink`
54+
- `Add-GitHubActionsStepSummarySubscriptText`
55+
- `Add-GitHubActionsStepSummarySuperscriptText`
5356
- `Disable-GitHubActionsEchoingCommands`
5457
- `Disable-GitHubActionsProcessingCommands`
5558
- `Enable-GitHubActionsEchoingCommands`

hugoalh.GitHubActionsToolkit/hugoalh.GitHubActionsToolkit.psd1

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,11 @@
6565
'Add-ProblemMatcher',
6666
'Add-SecretMask',
6767
'Add-StepSummary',
68+
'Add-StepSummaryHeader',
6869
'Add-StepSummaryImage',
6970
'Add-StepSummaryLink',
71+
'Add-StepSummarySubscriptText',
72+
'Add-StepSummarySuperscriptText',
7073
'Disable-EchoingCommands',
7174
'Disable-ProcessingCommands',
7275
'Enable-EchoingCommands',
@@ -109,6 +112,8 @@
109112
'Add-StepSummaryHyperlink',
110113
'Add-StepSummaryPicture',
111114
'Add-StepSummaryRaw',
115+
'Add-StepSummarySubscript',
116+
'Add-StepSummarySuperscript',
112117
'Disable-CommandEcho',
113118
'Disable-CommandEchoing',
114119
'Disable-CommandProcess',

hugoalh.GitHubActionsToolkit/module/step-summary.psm1

Lines changed: 73 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,28 @@ Function Add-StepSummary {
3737
Set-Alias -Name 'Add-StepSummaryRaw' -Value 'Add-StepSummary' -Option 'ReadOnly' -Scope 'Local'
3838
<#
3939
.SYNOPSIS
40+
GitHub Actions - Add Step Summary Header
41+
.DESCRIPTION
42+
Add header for step so that it will display on the summary page of a run.
43+
.PARAMETER Level
44+
Header level
45+
.PARAMETER Header
46+
Header title.
47+
#>
48+
Function Add-StepSummaryHeader {
49+
[CmdletBinding(HelpUri = 'https://github.com/hugoalh-studio/ghactions-toolkit-powershell/wiki/api_function_add-githubactionsstepsummaryheader#Add-GitHubActionsStepSummaryHeader')]
50+
[OutputType([Void])]
51+
Param (
52+
[Parameter(Mandatory = $True, Position = 0)][ValidateRange(1, 6)][UInt16]$Level,
53+
[Parameter(Mandatory = $True, Position = 1)][Alias('Title', 'Value')][String]$Header
54+
)
55+
Return (Add-StepSummary -Value "$('#' * $Level) $Header")
56+
}
57+
<#
58+
.SYNOPSIS
4059
GitHub Actions - Add Step Summary Image
4160
.DESCRIPTION
42-
Add some GitHub flavored Markdown image for step so that it will display on the summary page of a run.
61+
Add image for step so that it will display on the summary page of a run.
4362
IMPORTANT: No support reference image!
4463
.PARAMETER Uri
4564
Image URI.
@@ -97,18 +116,14 @@ Set-Alias -Name 'Add-StepSummaryPicture' -Value 'Add-StepSummaryImage' -Option '
97116
.SYNOPSIS
98117
GitHub Actions - Add Step Summary Link
99118
.DESCRIPTION
100-
Add some GitHub flavored Markdown link for step so that it will display on the summary page of a run.
119+
Add link for step so that it will display on the summary page of a run.
101120
IMPORTANT: No support reference link!
121+
.PARAMETER Text
122+
Link text.
102123
.PARAMETER Uri
103-
Image URI.
124+
Link URI.
104125
.PARAMETER Title
105-
Image title.
106-
.PARAMETER AlternativeText
107-
Image alternative text.
108-
.PARAMETER Width
109-
Image width.
110-
.PARAMETER Height
111-
Image height.
126+
Link title.
112127
.PARAMETER NoNewLine
113128
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.
114129
#>
@@ -118,7 +133,8 @@ Function Add-StepSummaryLink {
118133
Param (
119134
[Parameter(Mandatory = $True, Position = 0)][String]$Text,
120135
[Parameter(Mandatory = $True, Position = 1)][Alias('Url')][String]$Uri,
121-
[String]$Title
136+
[String]$Title,
137+
[Switch]$NoNewLine
122138
)
123139
[String]$ResultMarkdown = "[$Text]($Uri"
124140
If ($Title.Length -igt 0) {
@@ -130,6 +146,46 @@ Function Add-StepSummaryLink {
130146
Set-Alias -Name 'Add-StepSummaryHyperlink' -Value 'Add-StepSummaryLink' -Option 'ReadOnly' -Scope 'Local'
131147
<#
132148
.SYNOPSIS
149+
GitHub Actions - Add Step Summary Subscript Text
150+
.DESCRIPTION
151+
Add subscript text for step so that it will display on the summary page of a run.
152+
.PARAMETER Text
153+
Text that need to subscript.
154+
.PARAMETER NoNewLine
155+
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.
156+
#>
157+
Function Add-StepSummarySubscriptText {
158+
[CmdletBinding(HelpUri = 'https://github.com/hugoalh-studio/ghactions-toolkit-powershell/wiki/api_function_add-githubactionsstepsummarysubscripttext#Add-GitHubActionsStepSummarySubscriptText')]
159+
[OutputType([Void])]
160+
Param (
161+
[Parameter(Mandatory = $True, Position = 0)][Alias('Input', 'InputObject', 'Object')][String]$Text,
162+
[Switch]$NoNewLine
163+
)
164+
Return (Add-StepSummary -Value "<sub>$Text</sub>" -NoNewLine:$NoNewLine)
165+
}
166+
Set-Alias -Name 'Add-StepSummarySubscript' -Value 'Add-StepSummarySubscriptText' -Option 'ReadOnly' -Scope 'Local'
167+
<#
168+
.SYNOPSIS
169+
GitHub Actions - Add Step Summary Superscript Text
170+
.DESCRIPTION
171+
Add superscript text for step so that it will display on the summary page of a run.
172+
.PARAMETER Text
173+
Text that need to superscript.
174+
.PARAMETER NoNewLine
175+
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.
176+
#>
177+
Function Add-StepSummarySuperscriptText {
178+
[CmdletBinding(HelpUri = 'https://github.com/hugoalh-studio/ghactions-toolkit-powershell/wiki/api_function_add-githubactionsstepsummarysuperscripttext#Add-GitHubActionsStepSummarySuperscriptText')]
179+
[OutputType([Void])]
180+
Param (
181+
[Parameter(Mandatory = $True, Position = 0)][Alias('Input', 'InputObject', 'Object')][String]$Text,
182+
[Switch]$NoNewLine
183+
)
184+
Return (Add-StepSummary -Value "<sup>$Text</sup>" -NoNewLine:$NoNewLine)
185+
}
186+
Set-Alias -Name 'Add-StepSummarySuperscript' -Value 'Add-StepSummarySuperscriptText' -Option 'ReadOnly' -Scope 'Local'
187+
<#
188+
.SYNOPSIS
133189
GitHub Actions - Get Step Summary
134190
.DESCRIPTION
135191
Get step summary that previously added/setted from functions `Add-GitHubActionsStepSummary` and `Set-GitHubActionsStepSummary`.
@@ -207,13 +263,18 @@ Function Set-StepSummary {
207263
}
208264
Export-ModuleMember -Function @(
209265
'Add-StepSummary',
266+
'Add-StepSummaryHeader',
210267
'Add-StepSummaryImage',
211268
'Add-StepSummaryLink',
269+
'Add-StepSummarySubscriptText'
270+
'Add-StepSummarySuperscriptText'
212271
'Get-StepSummary',
213272
'Remove-StepSummary',
214273
'Set-StepSummary'
215274
) -Alias @(
216275
'Add-StepSummaryHyperlink',
217276
'Add-StepSummaryPicture',
218-
'Add-StepSummaryRaw'
277+
'Add-StepSummaryRaw',
278+
'Add-StepSummarySubscript',
279+
'Add-StepSummarySuperscript'
219280
)

0 commit comments

Comments
 (0)