Skip to content

🩹 [Patch]: Improve help text on output when this action is used inside another composite action #55

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions scripts/outputs.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,20 @@ try {
$blue = $PSStyle.Foreground.Blue
$reset = $PSStyle.Reset
LogGroup " - $blue$($output.Name)$reset" {
$outputAccess = "Accessible via: [$blue`${{ fromJson(steps.$env:GITHUB_ACTION.outputs.result).$($output.Name) }}$reset]"
$outputFence = ('─' * ($outputAccess.Length - 9))
Write-Output $outputAccess
Write-Output $outputFence
# Provide help text for both direct and nested usage scenarios
if (-not [string]::IsNullOrEmpty($env:GITHUB_ACTION)) {
$directUsage = "Direct usage: [$blue`${{ fromJson(steps.$env:GITHUB_ACTION.outputs.result).$($output.Name) }}$reset]"
$nestedUsage = "Nested usage: [$blue`${{ fromJson(steps.<your-step-id>.outputs.result).$($output.Name) }}$reset]"
Write-Output $directUsage
Write-Output $nestedUsage
$outputFence = ('─' * ([Math]::Max($directUsage.Length, $nestedUsage.Length) - 9))
Write-Output $outputFence
} else {
$genericUsage = "Accessible via: [$blue`${{ fromJson(steps.<step-id>.outputs.result).$($output.Name) }}$reset]"
Write-Output $genericUsage
$outputFence = ('─' * ($genericUsage.Length - 9))
Write-Output $outputFence
}
$output.Value | Format-List | Out-String
}
}
Expand Down