Skip to content

Commit 557d141

Browse files
committed
Use compact jq output when writing to GITHUB_OUTPUT
`jq` pretty-prints arrays across multiple lines by default, which causes "Invalid format" errors when writing to GITHUB_OUTPUT. Adding `-c` keeps the JSON on a single line.
1 parent 577771d commit 557d141

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

.github/workflows/lint-build-test.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ jobs:
2727
echo "child-workspace-package-names=$(yarn workspaces list --no-private --json | jq --slurp --raw-output 'map(.name) | @json')" >> "$GITHUB_OUTPUT"
2828
shell: bash
2929

30-
3130
get-changed-packages:
3231
name: Get changed packages
3332
runs-on: ubuntu-latest
@@ -67,11 +66,11 @@ jobs:
6766
run: |
6867
if [[ -n "$MERGE_BASE" ]]; then
6968
OUTPUT=$(yarn tsx scripts/get-changed-workspaces.mts "$MERGE_BASE" "$HEAD_SHA")
70-
PACKAGES=$(echo "$OUTPUT" | jq '.names')
69+
PACKAGES=$(echo "$OUTPUT" | jq -c '.names')
7170
if [[ $(echo "$OUTPUT" | jq '.hasRootChange') == "true" ]]; then
7271
ESLINT_PATHS="full"
7372
else
74-
ESLINT_PATHS=$(echo "$OUTPUT" | jq '.locations')
73+
ESLINT_PATHS=$(echo "$OUTPUT" | jq -c '.locations')
7574
fi
7675
else
7776
PACKAGES=$(yarn workspaces list --no-private --json | jq --slurp --raw-output 'map(.name) | @json')

scripts/get-changed-workspaces.mts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import yargs from 'yargs';
22
import { hideBin } from 'yargs/helpers';
3+
34
import {
45
getAllWorkspaces,
56
checkRootChange,

0 commit comments

Comments
 (0)