@@ -175,17 +175,79 @@ function Add-GHActionsSecretMask {
175
175
}
176
176
<#
177
177
. SYNOPSIS
178
- GitHub Actions - Get Debug Status
178
+ GitHub Actions - Disable Command Echo
179
179
. DESCRIPTION
180
- Get debug status .
180
+ Disable echoing of workflow commands, the workflow run's log will not show the command itself; A workflow command is echoed if there are any errors processing the command; Secret `ACTIONS_STEP_DEBUG` will ignore this .
181
181
#>
182
- function Get-GHActionsIsDebug {
182
+ function Disable-GHActionsCommandEcho {
183
+ [CmdletBinding ()]
184
+ param ()
185
+ Write-GHActionsCommand - Command ' echo' - Message ' off'
186
+ }
187
+ <#
188
+ . SYNOPSIS
189
+ GitHub Actions - Disable Processing Command
190
+ . DESCRIPTION
191
+ Stop processing any workflow commands to allow log anything without accidentally running workflow commands.
192
+ #>
193
+ function Disable-GHActionsProcessingCommand {
194
+ [CmdletBinding ()]
195
+ param ()
196
+ $EndToken = (New-Guid ).Guid
197
+ Write-GHActionsCommand - Command ' stop-commands' - Message $EndToken
198
+ return $EndToken
199
+ }
200
+ <#
201
+ . SYNOPSIS
202
+ GitHub Actions - Enable Command Echo
203
+ . DESCRIPTION
204
+ Enable echoing of workflow commands, the workflow run's log will show the command itself; The `add-mask`, `debug`, `warning`, and `error` commands do not support echoing because their outputs are already echoed to the log; Secret `ACTIONS_STEP_DEBUG` will ignore this.
205
+ #>
206
+ function Enable-GHActionsCommandEcho {
207
+ [CmdletBinding ()]
208
+ param ()
209
+ Write-GHActionsCommand - Command ' echo' - Message ' on'
210
+ }
211
+ <#
212
+ . SYNOPSIS
213
+ GitHub Actions - Enable Processing Command
214
+ . DESCRIPTION
215
+ Resume processing any workflow commands to allow running workflow commands.
216
+ . PARAMETER EndToken
217
+ Token from `Disable-GHActionsProcessingCommand`.
218
+ #>
219
+ function Enable-GHActionsProcessingCommand {
220
+ [CmdletBinding ()]
221
+ param (
222
+ [Parameter (Mandatory = $true , Position = 0 )][string ]$EndToken
223
+ )
224
+ Write-GHActionsCommand - Command $EndToken - Message ' '
225
+ }
226
+ <#
227
+ . SYNOPSIS
228
+ GitHub Actions - Enter Log Group
229
+ . DESCRIPTION
230
+ Create an expandable group in the log; Anything write to the log between `Enter-GHActionsLogGroup` and `Exit-GHActionsLogGroup` commands are inside an expandable group in the log.
231
+ . PARAMETER Title
232
+ Title of the log group.
233
+ #>
234
+ function Enter-GHActionsLogGroup {
235
+ [CmdletBinding ()]
236
+ param (
237
+ [Parameter (Mandatory = $true , Position = 0 )][string ]$Title
238
+ )
239
+ Send-GHActionsCommand - Command ' group' - Message $Title
240
+ }
241
+ <#
242
+ . SYNOPSIS
243
+ GitHub Actions - Exit Log Group
244
+ . DESCRIPTION
245
+ End an expandable group in the log.
246
+ #>
247
+ function Exit-GHActionsLogGroup {
183
248
[CmdletBinding ()]
184
249
param ()
185
- if ($env: RUNNER_DEBUG -eq ' true' ) {
186
- return $true
187
- }
188
- return $false
250
+ Send-GHActionsCommand - Command ' endgroup' - Message ' '
189
251
}
190
252
<#
191
253
. SYNOPSIS
@@ -235,6 +297,20 @@ function Get-GHActionsInput {
235
297
}
236
298
<#
237
299
. SYNOPSIS
300
+ GitHub Actions - Get Debug Status
301
+ . DESCRIPTION
302
+ Get debug status.
303
+ #>
304
+ function Get-GHActionsIsDebug {
305
+ [CmdletBinding ()]
306
+ param ()
307
+ if ($env: RUNNER_DEBUG -eq ' true' ) {
308
+ return $true
309
+ }
310
+ return $false
311
+ }
312
+ <#
313
+ . SYNOPSIS
238
314
GitHub Actions - Get State
239
315
. DESCRIPTION
240
316
Get state.
@@ -275,9 +351,30 @@ function Get-GHActionsState {
275
351
}
276
352
<#
277
353
. SYNOPSIS
354
+ Execute script block in a log group.
355
+ . PARAMETER Title
356
+ Title of the log group.
357
+ . PARAMETER ScriptBlock
358
+ Script block to execute in the log group.
359
+ #>
360
+ function Invoke-GHActionsScriptGroup {
361
+ [CmdletBinding ()]
362
+ param (
363
+ [Parameter (Mandatory = $true , Position = 0 )][string ]$Title ,
364
+ [Parameter (Mandatory = $true , Position = 1 )][scriptblock ]$ScriptBlock
365
+ )
366
+ Enter-GHActionsLogGroup - Title $Title
367
+ try {
368
+ return $ScriptBlock.Invoke ()
369
+ } finally {
370
+ Exit-GHActionsLogGroup
371
+ }
372
+ }
373
+ <#
374
+ . SYNOPSIS
278
375
GitHub Actions - Set Output
279
376
. DESCRIPTION
280
- Set an output.
377
+ Set output.
281
378
. PARAMETER Name
282
379
Name of the output.
283
380
. PARAMETER Value
@@ -291,104 +388,14 @@ function Set-GHActionsOutput {
291
388
)
292
389
Write-GHActionsCommand - Command ' set-output' - Message $Value - Properties @ {' name' = $Name }
293
390
}
294
- <#
295
- . SYNOPSIS
296
- GitHub Actions - Set Outputs
297
- . DESCRIPTION
298
- Set outputs.
299
- . PARAMETER InputObject
300
- Outputs.
301
- #>
302
- function Set-GHActionsOutputs {
303
- [CmdletBinding ()]
304
- param (
305
- [Parameter (Mandatory = $true , Position = 0 , ValueFromPipeline = $true )][hashtable ]$InputObject
306
- )
307
- begin {}
308
- process {
309
- $InputObject.GetEnumerator () | ForEach-Object - Process {
310
- Set-GHActionsOutput - Name $_.Name - Value $_.Value
311
- }
312
- }
313
- end {}
314
- }
315
- function Save-GHActionsState {
391
+ function Set-GHActionsState {
316
392
[CmdletBinding ()]
317
393
param (
318
394
[Parameter (Mandatory = $true , Position = 0 )][string ]$Name ,
319
395
[Parameter (Mandatory = $true , Position = 1 )][string ]$Value
320
396
)
321
397
Write-GHActionsCommand - Command ' save-state' - Message $Value - Properties @ {' name' = $Name }
322
398
}
323
- function Disable-GHActionsCommandEcho {
324
- [CmdletBinding ()]
325
- param ()
326
- Write-GHActionsCommand - Command ' echo' - Message ' off'
327
- }
328
- function Disable-GHActionsProcessingCommand {
329
- [CmdletBinding ()]
330
- param ()
331
- $EndToken = (New-Guid ).Guid
332
- Write-GHActionsCommand - Command ' stop-commands' - Message $EndToken
333
- return $EndToken
334
- }
335
- function Enable-GHActionsCommandEcho {
336
- [CmdletBinding ()]
337
- param ()
338
- Write-GHActionsCommand - Command ' echo' - Message ' on'
339
- }
340
- function Enable-GHActionsProcessingCommand {
341
- [CmdletBinding ()]
342
- param (
343
- [Parameter (Mandatory = $true , Position = 0 )][string ]$EndToken
344
- )
345
- Write-GHActionsCommand - Command $EndToken - Message ' '
346
- }
347
- <#
348
- . SYNOPSIS
349
- Create an expandable group in the log.
350
- . DESCRIPTION
351
- Anything write to the log between `Enter-GHActionsLogGroup` and `Exit-GHActionsLogGroup` commands are inside an expandable group in the log.
352
- . PARAMETER Title
353
- Title of the log group.
354
- #>
355
- function Enter-GHActionsLogGroup {
356
- [CmdletBinding ()]
357
- param (
358
- [Parameter (Mandatory = $true , Position = 0 )][string ]$Title
359
- )
360
- Send-GHActionsCommand - Command ' group' - Message $Title
361
- }
362
- <#
363
- . SYNOPSIS
364
- End an output group.
365
- #>
366
- function Exit-GHActionsLogGroup {
367
- [CmdletBinding ()]
368
- param ()
369
- Send-GHActionsCommand - Command ' endgroup' - Message ' '
370
- }
371
- <#
372
- . SYNOPSIS
373
- Execute script block in a log group.
374
- . PARAMETER Title
375
- Title of the log group.
376
- . PARAMETER ScriptBlock
377
- Script block to execute in the log group.
378
- #>
379
- function Invoke-GHActionsScriptGroup {
380
- [CmdletBinding ()]
381
- param (
382
- [Parameter (Mandatory = $true , Position = 0 )][string ]$Title ,
383
- [Parameter (Mandatory = $true , Position = 1 )][scriptblock ]$ScriptBlock
384
- )
385
- Enter-GHActionsLogGroup - Title $Title
386
- try {
387
- return $ScriptBlock.Invoke ()
388
- } finally {
389
- Exit-GHActionsLogGroup
390
- }
391
- }
392
399
function Write-GHActionsDebug {
393
400
[CmdletBinding ()]
394
401
param (
@@ -519,4 +526,4 @@ function Write-GHActionsWarning {
519
526
}
520
527
end {}
521
528
}
522
- Export-ModuleMember - Function Add-GHActionsEnvironmentVariable , Add-GHActionsPATH , Add-GHActionsSecretMask , Disable-GHActionsCommandEcho , Disable-GHActionsProcessingCommand , Enable-GHActionsCommandEcho , Enable-GHActionsProcessingCommand , Enter-GHActionsLogGroup , Exit-GHActionsLogGroup , Get-GHActionsInput , Get-GHActionsIsDebug , Get-GHActionsState , Invoke-GHActionsScriptGroup , Set-GHActionsOutput , Write-GHActionsDebug , Write-GHActionsError , Write-GHActionsFail , Write-GHActionsNotice , Write-GHActionsWarning
529
+ Export-ModuleMember - Function Add-GHActionsEnvironmentVariable , Add-GHActionsPATH , Add-GHActionsSecretMask , Disable-GHActionsCommandEcho , Disable-GHActionsProcessingCommand , Enable-GHActionsCommandEcho , Enable-GHActionsProcessingCommand , Enter-GHActionsLogGroup , Exit-GHActionsLogGroup , Get-GHActionsInput , Get-GHActionsIsDebug , Get-GHActionsState , Invoke-GHActionsScriptGroup , Set-GHActionsOutput , Set-GHActionsState , Write-GHActionsDebug , Write-GHActionsError , Write-GHActionsFail , Write-GHActionsNotice , Write-GHActionsWarning
0 commit comments