Skip to content

Commit c8f75c2

Browse files
committed
Add function output type attribute
1 parent ae3ea9b commit c8f75c2

File tree

1 file changed

+25
-24
lines changed

1 file changed

+25
-24
lines changed

hugoalh.GitHubActionsToolkit/hugoalh.GitHubActionsToolkit.psm1

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Also escape command properties characters.
1111
String
1212
#>
1313
function Format-GHActionsEscapeCharacters {
14-
[CmdletBinding()]
14+
[CmdletBinding()][OutputType([string])]
1515
param(
1616
[Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true)][AllowEmptyString()][string]$InputObject,
1717
[switch]$Command
@@ -34,10 +34,10 @@ An internal function to validate environment variable.
3434
.PARAMETER InputObject
3535
Environment variable that need to validate.
3636
.OUTPUTS
37-
Boolean | Void
37+
Boolean
3838
#>
3939
function Test-GHActionsEnvironmentVariable {
40-
[CmdletBinding()]
40+
[CmdletBinding()][OutputType([bool])]
4141
param (
4242
[Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true)][string]$InputObject
4343
)
@@ -47,6 +47,7 @@ function Test-GHActionsEnvironmentVariable {
4747
return $true
4848
}
4949
Write-Error -Message "Input `"$InputObject`" is not match the require environment variable pattern." -Category SyntaxError
50+
return $false
5051
}
5152
end {}
5253
}
@@ -65,7 +66,7 @@ Workflow command properties.
6566
Void
6667
#>
6768
function Write-GHActionsCommand {
68-
[CmdletBinding()]
69+
[CmdletBinding()][OutputType([void])]
6970
param (
7071
[Parameter(Mandatory = $true, Position = 0)][string]$Command,
7172
[Parameter(Mandatory = $true, Position = 1)][AllowEmptyString()][string]$Message,
@@ -95,7 +96,7 @@ Environment variable value.
9596
Void
9697
#>
9798
function Add-GHActionsEnvironmentVariable {
98-
[CmdletBinding(DefaultParameterSetName = 'single')]
99+
[CmdletBinding(DefaultParameterSetName = 'single')][OutputType([void])]
99100
param(
100101
[Parameter(Mandatory = $true, ParameterSetName = 'multiple', Position = 0, ValueFromPipeline = $true)]$InputObject,
101102
[Parameter(Mandatory = $true, ParameterSetName = 'single', Position = 0)][ValidatePattern('^[\da-z_]+$')][string]$Name,
@@ -155,7 +156,7 @@ System path.
155156
Void
156157
#>
157158
function Add-GHActionsPATH {
158-
[CmdletBinding()]
159+
[CmdletBinding()][OutputType([void])]
159160
param(
160161
[Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)][string[]]$Path
161162
)
@@ -186,7 +187,7 @@ The secret.
186187
Void
187188
#>
188189
function Add-GHActionsSecretMask {
189-
[CmdletBinding()]
190+
[CmdletBinding()][OutputType([void])]
190191
param(
191192
[Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true)][string]$Value
192193
)
@@ -205,7 +206,7 @@ Disable echoing of workflow commands, the workflow run's log will not show the c
205206
Void
206207
#>
207208
function Disable-GHActionsCommandEcho {
208-
[CmdletBinding()]
209+
[CmdletBinding()][OutputType([void])]
209210
param()
210211
Write-GHActionsCommand -Command 'echo' -Message 'off'
211212
}
@@ -218,7 +219,7 @@ Stop processing any workflow commands to allow log anything without accidentally
218219
String
219220
#>
220221
function Disable-GHActionsProcessingCommand {
221-
[CmdletBinding()]
222+
[CmdletBinding()][OutputType([string])]
222223
param()
223224
[string]$EndToken = (New-Guid).Guid
224225
Write-GHActionsCommand -Command 'stop-commands' -Message $EndToken
@@ -233,7 +234,7 @@ Enable echoing of workflow commands, the workflow run's log will show the comman
233234
Void
234235
#>
235236
function Enable-GHActionsCommandEcho {
236-
[CmdletBinding()]
237+
[CmdletBinding()][OutputType([void])]
237238
param()
238239
Write-GHActionsCommand -Command 'echo' -Message 'on'
239240
}
@@ -248,7 +249,7 @@ Token from `Disable-GHActionsProcessingCommand`.
248249
Void
249250
#>
250251
function Enable-GHActionsProcessingCommand {
251-
[CmdletBinding()]
252+
[CmdletBinding()][OutputType([void])]
252253
param(
253254
[Parameter(Mandatory = $true, Position = 0)][string]$EndToken
254255
)
@@ -265,7 +266,7 @@ Title of the log group.
265266
Void
266267
#>
267268
function Enter-GHActionsLogGroup {
268-
[CmdletBinding()]
269+
[CmdletBinding()][OutputType([void])]
269270
param(
270271
[Parameter(Mandatory = $true, Position = 0)][string]$Title
271272
)
@@ -280,7 +281,7 @@ End an expandable group in the log.
280281
Void
281282
#>
282283
function Exit-GHActionsLogGroup {
283-
[CmdletBinding()]
284+
[CmdletBinding()][OutputType([void])]
284285
param ()
285286
Write-GHActionsCommand -Command 'endgroup' -Message ''
286287
}
@@ -299,7 +300,7 @@ Trim the input's value.
299300
Hashtable | String
300301
#>
301302
function Get-GHActionsInput {
302-
[CmdletBinding()]
303+
[CmdletBinding()][OutputType([hashtable], [string])]
303304
param(
304305
[Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true)][string[]]$Name,
305306
[switch]$Require,
@@ -341,7 +342,7 @@ Get debug status.
341342
Boolean
342343
#>
343344
function Get-GHActionsIsDebug {
344-
[CmdletBinding()]
345+
[CmdletBinding()][OutputType([bool])]
345346
param ()
346347
if ($env:RUNNER_DEBUG -eq 'true') {
347348
return $true
@@ -361,7 +362,7 @@ Trim the state's value.
361362
Hashtable | String
362363
#>
363364
function Get-GHActionsState {
364-
[CmdletBinding()]
365+
[CmdletBinding()][OutputType([hashtable], [string])]
365366
param(
366367
[Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true)][string[]]$Name,
367368
[switch]$Trim
@@ -399,7 +400,7 @@ Get the complete webhook event payload.
399400
PSCustomObject
400401
#>
401402
function Get-GHActionsWebhookEventPayload {
402-
[CmdletBinding()]
403+
[CmdletBinding()][OutputType([pscustomobject])]
403404
param ()
404405
return (Get-Content -Path $env:GITHUB_EVENT_PATH -Raw -Encoding utf8NoBOM | ConvertFrom-Json)
405406
}
@@ -416,7 +417,7 @@ Value of the output.
416417
Void
417418
#>
418419
function Set-GHActionsOutput {
419-
[CmdletBinding()]
420+
[CmdletBinding()][OutputType([void])]
420421
param(
421422
[Parameter(Mandatory = $true, Position = 0)][string]$Name,
422423
[Parameter(Mandatory = $true, Position = 1)][string]$Value
@@ -436,7 +437,7 @@ Value of the state.
436437
Void
437438
#>
438439
function Set-GHActionsState {
439-
[CmdletBinding()]
440+
[CmdletBinding()][OutputType([void])]
440441
param(
441442
[Parameter(Mandatory = $true, Position = 0)][string]$Name,
442443
[Parameter(Mandatory = $true, Position = 1)][string]$Value
@@ -454,7 +455,7 @@ Message that need to log at debug level.
454455
Void
455456
#>
456457
function Write-GHActionsDebug {
457-
[CmdletBinding()]
458+
[CmdletBinding()][OutputType([void])]
458459
param (
459460
[Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true)][string]$Message
460461
)
@@ -487,7 +488,7 @@ Issue title.
487488
Void
488489
#>
489490
function Write-GHActionsError {
490-
[CmdletBinding()]
491+
[CmdletBinding()][OutputType([void])]
491492
param (
492493
[Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true)][string]$Message,
493494
[Parameter()][string]$File,
@@ -534,7 +535,7 @@ Message that need to log at error level.
534535
Void
535536
#>
536537
function Write-GHActionsFail {
537-
[CmdletBinding()]
538+
[CmdletBinding()][OutputType([void])]
538539
param(
539540
[Parameter(Position = 0)][string]$Message = ''
540541
)
@@ -564,7 +565,7 @@ Issue title.
564565
Void
565566
#>
566567
function Write-GHActionsNotice {
567-
[CmdletBinding()]
568+
[CmdletBinding()][OutputType([void])]
568569
param (
569570
[Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true)][string]$Message,
570571
[Parameter()][string]$File,
@@ -623,7 +624,7 @@ Issue title.
623624
Void
624625
#>
625626
function Write-GHActionsWarning {
626-
[CmdletBinding()]
627+
[CmdletBinding()][OutputType([void])]
627628
param (
628629
[Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true)][string]$Message,
629630
[Parameter()][string]$File,

0 commit comments

Comments
 (0)