Skip to content

Commit 1231009

Browse files
committed
fix(ci): improve JSON file validation logic in coverage workflow
Refactored the JSON file validation loop to use a while-read construct for better handling of filenames with spaces and special characters. This change enhances the robustness of the coverage data extraction process.
1 parent 655cb77 commit 1231009

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

.github/workflows/fortress-coverage.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -451,14 +451,14 @@ jobs:
451451
# Validate extracted history files contain actual coverage data
452452
EXTRACTED_FILES=$(find . -name "*.json" -type f 2>/dev/null | wc -l || echo "0")
453453
VALID_FILES=0
454-
for json_file in $(find . -name "*.json" -type f 2>/dev/null); do
454+
while IFS= read -r -d '' json_file; do
455455
if [[ -s "$json_file" ]] && grep -q "coverage" "$json_file" 2>/dev/null; then
456456
VALID_FILES=$((VALID_FILES + 1))
457457
else
458458
echo " ⚠️ Removing invalid history file: $(basename "$json_file")"
459459
rm -f "$json_file"
460460
fi
461-
done
461+
done < <(find . -name "*.json" -type f -print0 2>/dev/null)
462462
echo " 📄 Extracted $EXTRACTED_FILES files, $VALID_FILES valid history entries"
463463
else
464464
echo " ⚠️ Failed to extract history-$run_id.zip (possibly corrupted)"

0 commit comments

Comments
 (0)