|
1 | 1 | name: Log Disk Space |
2 | 2 | description: Logs disk space usage on the runner |
| 3 | +inputs: |
| 4 | + detailed: |
| 5 | + description: 'Whether to include detailed disk analysis (true/false)' |
| 6 | + required: false |
| 7 | + default: 'false' |
3 | 8 | runs: |
4 | 9 | using: composite |
5 | 10 | steps: |
|
17 | 22 | echo "" |
18 | 23 | echo "=== Disk Usage Summary ===" |
19 | 24 | df -h / | tail -1 | awk '{print "Used: " $3 " / " $2 " (" $5 " full)"}' |
| 25 | + |
| 26 | + # Detailed analysis if requested |
| 27 | + if [ "${{ inputs.detailed }}" = "true" ]; then |
| 28 | + echo "" |
| 29 | + echo "=== DETAILED ANALYSIS ===" |
| 30 | + echo "" |
| 31 | + echo "=== Largest directories in /home/runner ===" |
| 32 | + sudo du -h /home/runner 2>/dev/null | sort -rh | head -20 |
| 33 | + echo "" |
| 34 | + echo "=== Largest directories in /opt ===" |
| 35 | + sudo du -h /opt 2>/dev/null | sort -rh | head -20 |
| 36 | + echo "" |
| 37 | + echo "=== Workspace breakdown (top level) ===" |
| 38 | + du -h --max-depth=1 . 2>/dev/null | sort -rh |
| 39 | + echo "" |
| 40 | + echo "=== Workspace breakdown (2 levels deep) ===" |
| 41 | + du -h --max-depth=2 . 2>/dev/null | sort -rh | head -30 |
| 42 | + echo "" |
| 43 | + echo "=== externals directory ===" |
| 44 | + du -sh ./externals/* 2>/dev/null | sort -rh | head -20 || echo "No externals" |
| 45 | + echo "" |
| 46 | + echo "=== output directory ===" |
| 47 | + du -sh ./output/* 2>/dev/null | sort -rh | head -20 || echo "No output" |
| 48 | + echo "" |
| 49 | + echo "=== generated directory ===" |
| 50 | + du -sh ./generated/* 2>/dev/null | sort -rh | head -20 || echo "No generated" |
| 51 | + echo "" |
| 52 | + echo "=== /mnt disk usage ===" |
| 53 | + du -h --max-depth=1 /mnt 2>/dev/null | sort -rh |
| 54 | + echo "" |
| 55 | + echo "=== Docker usage ===" |
| 56 | + docker system df 2>/dev/null || echo "Docker not available" |
| 57 | + echo "" |
| 58 | + echo "=== Temp directories ===" |
| 59 | + du -sh /tmp /var/tmp 2>/dev/null || true |
| 60 | + fi |
0 commit comments