fix: address copilot review feedback

- Fix shell scripting issue with unquoted variables in forward-logs.sh
- Add error handling to hook script before executing forward-logs.sh
- Use null-terminated while loop to handle filenames with spaces
This commit is contained in:
robert lestak 2025-12-16 13:58:01 -08:00
parent 566d6bdc6d
commit fac29b778d
2 changed files with 13 additions and 9 deletions

View File

@ -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 ==="

View File

@ -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