File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -190,18 +190,18 @@ jobs:
190190 set -euo pipefail
191191 cd algolia
192192 SITE_PRODUCT="${SITE_PRODUCT:-1}"
193- echo "Setting product=\"$SITE_PRODUCT \" for Algolia JSON files (only when missing/empty)."
193+ echo "Setting product=\"$PRODUCT \" for Algolia JSON files (only when missing/empty)."
194194
195195 for f in *.json; do
196196 echo "Processing $f ..."
197197 if jq -e 'type == "array"' "$f" >/dev/null 2>&1; then
198- jq --arg p "$SITE_PRODUCT " 'map(if (.product == null or .product == "") then . + {product:$p} else . end)' "$f" > "$f.tmp"
198+ jq --arg p "$PRODUCT " 'map(if (.product == null or .product == "") then . + {product:$p} else . end)' "$f" > "$f.tmp"
199199 mv "$f.tmp" "$f"
200200 elif jq -e 'has("records") and (.records | type == "array")' "$f" >/dev/null 2>&1; then
201- jq --arg p "$SITE_PRODUCT " '.records = (.records | map(if (.product == null or .product == "") then . + {product:$p} else . end))' "$f" > "$f.tmp"
201+ jq --arg p "$PRODUCT " '.records = (.records | map(if (.product == null or .product == "") then . + {product:$p} else . end))' "$f" > "$f.tmp"
202202 mv "$f.tmp" "$f"
203203 elif jq -e 'type == "object"' "$f" >/dev/null 2>&1; then
204- jq --arg p "$SITE_PRODUCT " 'if (.product == null or .product == "") then . + {product:$p} else . end' "$f" > "$f.tmp"
204+ jq --arg p "$PRODUCT " 'if (.product == null or .product == "") then . + {product:$p} else . end' "$f" > "$f.tmp"
205205 mv "$f.tmp" "$f"
206206 else
207207 echo "Unknown top-level JSON type for $f — attempting NDJSON-per-line patch."
@@ -213,7 +213,7 @@ jobs:
213213 continue
214214 fi
215215 if echo "$trimmed" | jq -e '.' >/dev/null 2>&1; then
216- echo "$trimmed" | jq -c --arg p "$SITE_PRODUCT " 'if (.product == null or .product == "") then . + {product:$p} else . end' >> "$tmp"
216+ echo "$trimmed" | jq -c --arg p "$PRODUCT " 'if (.product == null or .product == "") then . + {product:$p} else . end' >> "$tmp"
217217 else
218218 echo "$line" >> "$tmp"
219219 fi
You can’t perform that action at this time.
0 commit comments