Skip to content

Commit a7c6c7d

Browse files
🩹 [Patch] Update Set-GitHubOutput to pretty-print JSON structure (#399)
## Description This pull request makes a minor change to the `ConvertTo-GitHubOutput` function by removing the `-Compress` parameter from `ConvertTo-Json` calls. This pretty-prints the JSON output, so that its nicer to review in GitHub Actions logs. * Simplified JSON output: - Removed the `-Compress` parameter from `ConvertTo-Json` calls for both valid JSON strings and non-string values. This ensures consistent formatting without compression. ## Type of change <!-- Use the check-boxes [x] on the options that are relevant. --> - [ ] 📖 [Docs] - [ ] 🪲 [Fix] - [x] 🩹 [Patch] - [ ] ⚠️ [Security fix] - [ ] 🚀 [Feature] - [ ] 🌟 [Breaking change] ## Checklist <!-- Use the check-boxes [x] on the options that are relevant. --> - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas
1 parent 5eec977 commit a7c6c7d

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/functions/private/Commands/ConvertTo-GitHubOutput.ps1

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,13 @@
7575
if ($value -is [string]) {
7676
if (Test-Json $value -ErrorAction SilentlyContinue) {
7777
# Normalize valid JSON strings to a consistent format.
78-
$value = ($value | ConvertFrom-Json) | ConvertTo-Json -Compress -Depth 100
78+
$value = ($value | ConvertFrom-Json) | ConvertTo-Json -Depth 100
7979
}
8080
} else {
8181
# For non-string values, convert to JSON.
82-
$value = $value | ConvertTo-Json -Compress -Depth 100
82+
$value = $value | ConvertTo-Json -Depth 100
8383
}
8484

85-
8685
$guid = [Guid]::NewGuid().ToString()
8786
$EOFMarker = "EOF_$guid"
8887
$outputLines += "$key<<$EOFMarker"

0 commit comments

Comments
 (0)