Skip to content

Commit

Permalink
ci: Have jq output in compact mode
Browse files Browse the repository at this point in the history
  • Loading branch information
redmushie committed Sep 30, 2023
1 parent 1c3a41c commit 8edd02f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .github/workflows/targets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:
#
# jq:
# "--raw-input --slurp" Takes the previous output,
# -c Output in compact mode (no newlines or unnecessary spaces),
# split("\n") Splits it by line, turning it into an array,
# [ .[] | select(length > 0) ] Filters out empty lines (there is an empty trailing line usually),
# { board: ... } Wraps the whole thing into a JSON object with only a "board" key
Expand All @@ -48,4 +49,4 @@ jobs:
- name: Extract targets
id: targets
run: |
echo "matrix=$(sed -n "s/^\[env:\(.*\)]$/\1/p" platformio.ini | jq --raw-input --slurp '{ board: split("\n") | [ .[] | select(length > 0) ] }')" >> $GITHUB_OUTPUT
echo "matrix=$(sed -n "s/^\[env:\(.*\)]$/\1/p" platformio.ini | jq --raw-input --slurp -c '{ board: split("\n") | [ .[] | select(length > 0) ] }')" >> $GITHUB_OUTPUT

0 comments on commit 8edd02f

Please sign in to comment.