-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathoutputs.ps1
More file actions
59 lines (45 loc) · 1.64 KB
/
Copy pathoutputs.ps1
File metadata and controls
59 lines (45 loc) · 1.64 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#Requires -Modules GitHub
[CmdletBinding()]
param()
$scriptName = $MyInvocation.MyCommand.Name
Write-Debug "[$scriptName] - Start"
try {
$fenceTitle = $env:PSMODULE_GITHUB_SCRIPT_INPUT_Name
$showOutput = $env:PSMODULE_GITHUB_SCRIPT_INPUT_ShowOutput -eq 'true'
$showRateLimit = $env:PSMODULE_GITHUB_SCRIPT_INPUT_ShowRateLimit -eq 'true'
Write-Debug "[$scriptName] - ShowOutput: $showOutput"
Write-Debug "[$scriptName] - ShowRateLimit: $showRateLimit"
$result = $null
$hasResult = $false
if ($showOutput) {
$result = (Get-GitHubOutput).result
$hasResult = [bool]$result
Write-Debug "[$scriptName] - ResultPresent: $hasResult"
}
if (-not $hasResult -and -not $showRateLimit) {
return
}
$fenceStart = "┏━━┫ $fenceTitle - Outputs ┣━━━━━┓"
Write-Output $fenceStart
if ($hasResult) {
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
}
}
} # end if ($result)
& "$PSScriptRoot/ratelimit.ps1"
$fenceEnd = '┗' + ('━' * ($fenceStart.Length - 2)) + '┛'
Write-Output $fenceEnd
} catch {
throw $_
}
Write-Debug "$scriptName - End"