Skip to content

Commit 05bc7b4

Browse files
committed
fix: use different approach
1 parent 5396db5 commit 05bc7b4

1 file changed

Lines changed: 26 additions & 27 deletions

File tree

.github/actions/test-statistics/action.yml

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -293,33 +293,32 @@ runs:
293293
else
294294
echo "⚠️ JSON creation failed, creating minimal statistics file"
295295
# Create minimal fallback JSON
296-
cat > "$STATS_FILE" << EOF
297-
{
298-
"name": "${{ inputs.matrix-name }}",
299-
"os": "${{ inputs.matrix-os }}",
300-
"go_version": "${{ inputs.matrix-go-version }}",
301-
"test_mode": "$OUTPUT_MODE",
302-
"duration_seconds": $TEST_DURATION,
303-
"test_count": ${TEST_COUNT:-0},
304-
"benchmark_count": ${BENCHMARK_COUNT:-0},
305-
"status": "${{ inputs.job-status }}",
306-
"test_exit_code": ${TEST_EXIT_CODE:-0},
307-
"test_passed": $TEST_PASSED,
308-
"total_failures": ${TOTAL_FAILURES:-0},
309-
"affected_packages": ${AFFECTED_PACKAGES:-0},
310-
"failure_details": [],
311-
"output_size_bytes": ${OUTPUT_SIZE:-0},
312-
"race_enabled": $RACE_ENABLED,
313-
"coverage_enabled": $COVERAGE_ENABLED,
314-
"fuzz_run": $FUZZ_RUN,
315-
"fuzz_test_count": ${FUZZ_TEST_COUNT:-0},
316-
"timestamp": "$(date -u +%Y-%m-%dT%H:%M:%SZ)",
317-
"loc_test_files": "$LOC_TEST_FILES",
318-
"loc_go_files": "$LOC_GO_FILES",
319-
"loc_total": "$LOC_TOTAL",
320-
"loc_date": "$LOC_DATE"
321-
}
322-
EOF
296+
printf '%s\n' \
297+
'{' \
298+
' "name": "'"${{ inputs.matrix-name }}"'",' \
299+
' "os": "'"${{ inputs.matrix-os }}"'",' \
300+
' "go_version": "'"${{ inputs.matrix-go-version }}"'",' \
301+
' "test_mode": "'"$OUTPUT_MODE"'",' \
302+
' "duration_seconds": '"$TEST_DURATION"',' \
303+
' "test_count": '"${TEST_COUNT:-0}"',' \
304+
' "benchmark_count": '"${BENCHMARK_COUNT:-0}"',' \
305+
' "status": "'"${{ inputs.job-status }}"'",' \
306+
' "test_exit_code": '"${TEST_EXIT_CODE:-0}"',' \
307+
' "test_passed": '"$TEST_PASSED"',' \
308+
' "total_failures": '"${TOTAL_FAILURES:-0}"',' \
309+
' "affected_packages": '"${AFFECTED_PACKAGES:-0}"',' \
310+
' "failure_details": [],' \
311+
' "output_size_bytes": '"${OUTPUT_SIZE:-0}"',' \
312+
' "race_enabled": '"$RACE_ENABLED"',' \
313+
' "coverage_enabled": '"$COVERAGE_ENABLED"',' \
314+
' "fuzz_run": '"$FUZZ_RUN"',' \
315+
' "fuzz_test_count": '"${FUZZ_TEST_COUNT:-0}"',' \
316+
' "timestamp": "'"$(date -u +%Y-%m-%dT%H:%M:%SZ)"'",' \
317+
' "loc_test_files": "'"$LOC_TEST_FILES"'",' \
318+
' "loc_go_files": "'"$LOC_GO_FILES"'",' \
319+
' "loc_total": "'"$LOC_TOTAL"'",' \
320+
' "loc_date": "'"$LOC_DATE"'"' \
321+
'}' > "$STATS_FILE"
323322
JSON_CREATE_SUCCESS=true
324323
echo "📊 Minimal test statistics generated successfully:"
325324
fi

0 commit comments

Comments
 (0)