-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathoutputs.ps1
More file actions
45 lines (37 loc) · 1.26 KB
/
outputs.ps1
File metadata and controls
45 lines (37 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#Requires -Modules GitHub
[CmdletBinding()]
param()
$scriptName = $MyInvocation.MyCommand.Name
Write-Debug "[$scriptName] - Start"
try {
$fenceTitle = $env:PSMODULE_GITHUB_SCRIPT_INPUT_Name
Write-Debug "[$scriptName] - ShowOutput: $env:PSMODULE_GITHUB_SCRIPT_INPUT_ShowOutput"
if ($env:PSMODULE_GITHUB_SCRIPT_INPUT_ShowOutput -ne 'true') {
return
}
$result = (Get-GitHubOutput).result
Write-Debug "[$scriptName] - Result: $(-not $result)"
if (-not $result) {
return
}
$fenceStart = "┏━━┫ $fenceTitle - Outputs ┣━━━━━┓"
Write-Output $fenceStart
if ([string]::IsNullOrEmpty($env:GITHUB_ACTION)) {
Write-GitHubWarning 'Outputs cannot be accessed as the step has no ID.'
}
if (-not (Test-Path -Path $env:GITHUB_OUTPUT)) {
Write-Warning "File not found: $env:GITHUB_OUTPUT"
}
foreach ($output in $result.PSObject.Properties) {
$blue = $PSStyle.Foreground.Blue
$reset = $PSStyle.Reset
LogGroup " - $blue$($output.Name)$reset" {
$output.Value | Format-List | Out-String
}
}
$fenceEnd = '┗' + ('━' * ($fenceStart.Length - 2)) + '┛'
Write-Output $fenceEnd
} catch {
throw $_
}
Write-Debug "$scriptName - End"