fix: resolve SIGPIPE error in GitHub mirror workflow file cleanup
- Replace problematic 'find | head -20' commands that caused exit code 141 - Use 'ls -la | head -10 || true' for safer file listing - Add better progress logging during sensitive file removal - Add error handling with '|| true' to prevent pipe failures The find command was outputting more than head could handle, causing SIGPIPE when head closed the pipe early. This fix uses ls which is more predictable and adds proper error handling.
This commit is contained in:
@@ -113,9 +113,11 @@ jobs:
|
|||||||
git checkout github-mirror
|
git checkout github-mirror
|
||||||
|
|
||||||
echo "Current files before cleanup:"
|
echo "Current files before cleanup:"
|
||||||
find . -name ".*" -o -name "*" | head -20
|
ls -la | head -10 || true
|
||||||
|
echo "..."
|
||||||
|
|
||||||
# Remove sensitive files/directories if they exist
|
# Remove sensitive files/directories if they exist
|
||||||
|
echo "Removing sensitive files..."
|
||||||
rm -rf .env* || true
|
rm -rf .env* || true
|
||||||
rm -rf backend/.env* || true
|
rm -rf backend/.env* || true
|
||||||
rm -rf frontend/.env* || true
|
rm -rf frontend/.env* || true
|
||||||
@@ -136,6 +138,8 @@ jobs:
|
|||||||
rm -rf test-maintenance.sh || true
|
rm -rf test-maintenance.sh || true
|
||||||
rm -rf storage/ || true
|
rm -rf storage/ || true
|
||||||
|
|
||||||
|
echo "Sensitive files removal completed"
|
||||||
|
|
||||||
# Add and commit the cleanup if there are changes
|
# Add and commit the cleanup if there are changes
|
||||||
git add -A
|
git add -A
|
||||||
if ! git diff --cached --quiet; then
|
if ! git diff --cached --quiet; then
|
||||||
@@ -145,8 +149,8 @@ jobs:
|
|||||||
echo "✅ No sensitive files to remove"
|
echo "✅ No sensitive files to remove"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Final file structure:"
|
echo "Final file structure (top level):"
|
||||||
find . -name ".*" -o -name "*" | head -20
|
ls -la | head -10 || true
|
||||||
|
|
||||||
- name: Verify clean history
|
- name: Verify clean history
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
Reference in New Issue
Block a user