Skip to content

Commit 6fadddd

Browse files
🩹 [Patch]: Standardize verbose output formatting in init and outputs scripts
1 parent 3216b7d commit 6fadddd

File tree

2 files changed

+32
-32
lines changed

2 files changed

+32
-32
lines changed

scripts/init.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ try {
2424
Write-Verbose 'Filtering by prerelease'
2525
$alreadyInstalled = $alreadyInstalled | Where-Object Prerelease -EQ $Prerelease
2626
}
27-
Write-Verbose "Already installed:"
27+
Write-Verbose 'Already installed:'
2828
Write-Verbose "$($alreadyInstalled | Format-List)"
2929
if (-not $alreadyInstalled) {
3030
$params = @{
@@ -73,7 +73,7 @@ try {
7373
'Provided ClientID' = $providedClientID
7474
'Provided PrivateKey' = $providedPrivateKey
7575
}
76-
Write-Verbose ($moduleStatus | Format-List)
76+
Write-Verbose "$($moduleStatus | Format-List)"
7777
if ($VerbosePreference -eq 'Continue') {
7878
Write-Output '::endgroup::'
7979
Write-Output '┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛'

scripts/outputs.ps1

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,40 @@
11
[CmdletBinding()]
22
param()
33

4-
$DebugPreference = 'SilentlyContinue'
5-
$VerbosePreference = 'SilentlyContinue'
6-
$scriptName = $MyInvocation.MyCommand.Name
7-
Write-Debug "[$scriptName] - Start"
4+
$DebugPreference = 'SilentlyContinue'
5+
$VerbosePreference = 'SilentlyContinue'
6+
$scriptName = $MyInvocation.MyCommand.Name
7+
Write-Debug "[$scriptName] - Start"
88

9-
try {
10-
Write-Debug "[$scriptName] - ShowOutput: $env:GITHUB_ACTION_INPUT_ShowOutput"
11-
if ($env:GITHUB_ACTION_INPUT_ShowOutput -ne 'true') {
12-
return
13-
}
9+
try {
10+
Write-Debug "[$scriptName] - ShowOutput: $env:GITHUB_ACTION_INPUT_ShowOutput"
11+
if ($env:GITHUB_ACTION_INPUT_ShowOutput -ne 'true') {
12+
return
13+
}
1414

15-
$result = (Get-GitHubOutput).result
16-
Write-Debug "[$scriptName] - Result: $(-not $result)"
17-
if (-not $result) {
18-
return
15+
$result = (Get-GitHubOutput).result
16+
Write-Debug "[$scriptName] - Result: $(-not $result)"
17+
if (-not $result) {
18+
return
19+
}
20+
$title = "┏━━━━━┫ $Name ┣━━━━━┓"
21+
Write-Output $title
22+
LogGroup ' - Outputs' {
23+
if ([string]::IsNullOrEmpty($env:GITHUB_ACTION)) {
24+
Write-GitHubWarning 'Outputs cannot be accessed as the step has no ID.'
1925
}
20-
$title = "┏━━━━━┫ $Name ┣━━━━━┓"
21-
Write-Output $title
22-
LogGroup ' - Outputs' {
23-
if ([string]::IsNullOrEmpty($env:GITHUB_ACTION)) {
24-
Write-GitHubWarning 'Outputs cannot be accessed as the step has no ID.'
25-
}
2626

27-
if (-not (Test-Path -Path $env:GITHUB_OUTPUT)) {
28-
Write-Warning "File not found: $env:GITHUB_OUTPUT"
29-
}
30-
31-
$result | Format-List
32-
Write-Host "Access outputs using `${{ fromJson(steps.$env:GITHUB_ACTION.outputs.result).<output-name> }}"
27+
if (-not (Test-Path -Path $env:GITHUB_OUTPUT)) {
28+
Write-Warning "File not found: $env:GITHUB_OUTPUT"
3329
}
34-
$endingFence = '' + ('' * ($title.Length - 2)) + ''
35-
Write-Output $endingFence
36-
} catch {
37-
throw $_
30+
31+
$result | Format-List
32+
Write-Host "Access outputs using `${{ fromJson(steps.$env:GITHUB_ACTION.outputs.result).<output-name> }}"
3833
}
34+
$endingFence = '' + ('' * ($title.Length - 2)) + ''
35+
Write-Output $endingFence
36+
} catch {
37+
throw $_
38+
}
3939

40-
Write-Debug "$scriptName - End"
40+
Write-Debug "$scriptName - End"

0 commit comments

Comments
 (0)