Skip to content

Commit b47a03c

Browse files
🩹 [Patch]: Optimize output retrieval and improve warning messages
1 parent f685e35 commit b47a03c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

scripts/outputs.ps1

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,23 @@ param()
44
$DebugPreference = 'SilentlyContinue'
55
$VerbosePreference = 'SilentlyContinue'
66

7+
$result = (Get-GitHubOutput).result
8+
if (-not $result) {
9+
return
10+
}
11+
712
Write-Host '┏━━━━━┫ GitHub-Script ┣━━━━━┓'
813

914
LogGroup ' - Outputs' {
1015
if ([string]::IsNullOrEmpty($env:GITHUB_ACTION)) {
11-
Write-Warning 'Outputs cannot be accessed as the step has no ID.'
16+
Write-GitHubWarning 'Outputs cannot be accessed as the step has no ID.'
1217
}
1318

1419
if (-not (Test-Path -Path $env:GITHUB_OUTPUT)) {
1520
Write-Warning "File not found: $env:GITHUB_OUTPUT"
1621
}
1722

18-
(Get-GitHubOutput).result | Format-List
23+
$result | Format-List
1924
Write-Host "Access outputs using `${{ fromJson(steps.$env:GITHUB_ACTION.outputs.result).<output-name> }}"
2025
}
2126

0 commit comments

Comments
 (0)