diff --git a/runner/forward-logs.sh b/runner/forward-logs.sh index 054ecbae..1cd4739f 100755 --- a/runner/forward-logs.sh +++ b/runner/forward-logs.sh @@ -17,16 +17,15 @@ if [ ! -d "$DIAG_DIR" ]; then fi # Find worker log files (these contain the actual job execution logs) -WORKER_LOGS=$(find "$DIAG_DIR" -name "Worker_*.log" -type f 2>/dev/null || true) - -if [ -z "$WORKER_LOGS" ]; then - echo "No worker log files found" - exit 0 -fi - echo "=== GITHUB ACTIONS BUILD LOGS START ===" -for log_file in $WORKER_LOGS; do +found_logs=0 +find "$DIAG_DIR" -name "Worker_*.log" -type f -print0 2>/dev/null | while IFS= read -r -d '' log_file; do + found_logs=1 echo "--- Log from: $(basename "$log_file") ---" cat "$log_file" done + +if [ "$found_logs" -eq 0 ]; then + echo "No worker log files found" +fi echo "=== GITHUB ACTIONS BUILD LOGS END ===" diff --git a/runner/hooks/job-completed.d/forward-logs b/runner/hooks/job-completed.d/forward-logs index 18c1164c..e4a6a2c5 100755 --- a/runner/hooks/job-completed.d/forward-logs +++ b/runner/hooks/job-completed.d/forward-logs @@ -1,4 +1,9 @@ #!/usr/bin/env bash set -u -exec forward-logs.sh +if command -v forward-logs.sh >/dev/null 2>&1; then + exec forward-logs.sh +else + echo "forward-logs.sh not found in PATH" + exit 1 +fi