File tree Expand file tree Collapse file tree 1 file changed +14
-6
lines changed
Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -78,15 +78,23 @@ 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'."
81+ # Ensure that the file is not a single valid JSON object/array
82+ if jq -e . < "$DOCUMENTS_JSONL" >/dev/null 2>&1; then
83+ echo "::error:: The file contains a single valid JSON structure, not JSON Lines format."
8784 exit 1
8885 fi
8986
87+ # Validate each line as a standalone JSON object/array
88+ LINE_NUM=0
89+ while IFS= read -r line || [ -n "$line" ]; do
90+ LINE_NUM=$((LINE_NUM + 1))
91+ echo "$line" | jq empty 2>/dev/null
92+ if [ $? -ne 0 ]; then
93+ echo "::error:: Invalid JSON on line $LINE_NUM: $line"
94+ exit 1
95+ fi
96+ done < "$DOCUMENTS_JSONL"
97+
9098 - name : Upload artifact
9199 uses : actions/upload-artifact@v4
92100 with :
You can’t perform that action at this time.
0 commit comments