File tree Expand file tree Collapse file tree 1 file changed +58
-0
lines changed
.github/actions/cleanup-space Expand file tree Collapse file tree 1 file changed +58
-0
lines changed Original file line number Diff line number Diff line change 1+ name : " Clean up runner disk space"
2+ description : " Removes large, non-essential toolsets to free up disk space on the runner."
3+
4+ runs :
5+ using : " composite"
6+ steps :
7+ - name : Free up disk space
8+ shell : bash
9+ run : |
10+ set -euxo pipefail
11+
12+ log_disk_usage() {
13+ echo "$1"
14+ df -h
15+ }
16+
17+ log_disk_usage "Disk space before cleanup:"
18+
19+ shopt -s nullglob
20+ directories_to_remove=(
21+ /usr/share/dotnet
22+ /usr/local/lib/android
23+ /opt/ghc
24+ /usr/share/swift
25+ /usr/local/julia*
26+ /opt/hostedtoolcache
27+ /usr/local/share/boost
28+ "${AGENT_TOOLSDIRECTORY:-}"
29+ )
30+
31+ for path in "${directories_to_remove[@]}"; do
32+ [[ -z "$path" ]] && continue
33+ sudo rm -rf -- "$path"
34+ done
35+
36+ if command -v docker >/dev/null 2>&1; then
37+ docker image prune -a -f || true
38+ fi
39+
40+ apt_packages=(
41+ '^aspnetcore-.*'
42+ '^dotnet-.*'
43+ '^llvm-.*'
44+ 'php.*'
45+ '^mongodb-.*'
46+ '^mysql-.*'
47+ azure-cli
48+ google-chrome-stable
49+ firefox
50+ powershell
51+ mono-devel
52+ libgl1-mesa-dri
53+ )
54+ sudo apt-get remove -y "${apt_packages[@]}" || true
55+ sudo apt-get autoremove -y
56+ sudo apt-get clean
57+
58+ log_disk_usage "Disk space after cleanup:"
You can’t perform that action at this time.
0 commit comments