Skip to content

Commit 20fd36f

Browse files
committed
fix: validate documents.jsonl lines
1 parent 5b99f17 commit 20fd36f

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

.github/workflows/deploy-to-cloud.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,15 @@ jobs:
7878
env:
7979
DOCUMENTS_JSONL: ${{ matrix.app.name }}/dist/documents.jsonl
8080
run: |
81-
# Validate the entire JSONL file using jq --stream
82-
if jq --stream . < "$DOCUMENTS_JSONL" >/dev/null 2>&1; then
83-
echo "JSONL file '$DOCUMENTS_JSONL' is valid."
84-
exit 0
85-
else
86-
echo "Error: Invalid JSONL format in '$FILE'."
87-
exit 1
88-
fi
81+
# Validate each line as a standalone JSON object/array
82+
LINE_NUM=0
83+
while IFS= read -r line || [ -n "$line" ]; do
84+
LINE_NUM=$((LINE_NUM + 1))
85+
echo "$line" | jq empty || (
86+
echo "::error:: Invalid JSON on line $LINE_NUM: $line"
87+
exit 1
88+
)
89+
done < "$DOCUMENTS_JSONL"
8990
9091
- name: Upload artifact
9192
uses: actions/upload-artifact@v4

0 commit comments

Comments
 (0)