ci: strip carriage returns from target list in filter-build validate step

The FIRMWARE_TARGETS repo variable contains CRLF line endings, so every
target name carries a trailing \r and the validate step rejects the first
entry ('Unknown build target'). Strip \r before splitting on
spaces/commas/newlines in both the validation loop and the JSON array
conversion.
This commit is contained in:
Jason Huebert committed 2026-09-24 14:35:00 -05:00
1 parent 32b8d4bdf5
commit e4796bceb1
1 file changed
+2 -2
+2 -2
View File
@@ -293,7 +293,7 @@ jobs:
sh build.sh list > /tmp/known-targets.txt
# fail hard on unknown names instead of silently skipping them
for target in $(echo "$TARGETS" | tr ' ,' '\n'); do
for target in $(echo "$TARGETS" | tr -d '\r' | tr ' ,' '\n'); do
[ -z "$target" ] && continue
if ! grep -qx "$target" /tmp/known-targets.txt; then
echo "Unknown build target: '$target'" >&2
@@ -302,7 +302,7 @@ jobs:
done
# convert targets separated by comma/newline into a json array string
JSON_ARRAY=$(echo "$TARGETS" | tr ' ,' '\n' | sed '/^$/d' | jq -R -s -c 'split("\n") | map(select(length > 0))')
JSON_ARRAY=$(echo "$TARGETS" | tr -d '\r' | tr ' ,' '\n' | sed '/^$/d' | jq -R -s -c 'split("\n") | map(select(length > 0))')
echo "targets=$JSON_ARRAY" >> $GITHUB_OUTPUT