Skip to content

Instantly share code, notes, and snippets.

@zfdang
Last active May 27, 2020 00:01
Show Gist options
  • Save zfdang/7d3d29fb0fe7559ef8798ec28d128659 to your computer and use it in GitHub Desktop.
Save zfdang/7d3d29fb0fe7559ef8798ec28d128659 to your computer and use it in GitHub Desktop.
Ubuntu Runner Disk Cleanup Script - Github Workflow Actions
name: Build_x86_64
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-18.04
steps :
- name: Disk Space cleanup
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo -E apt-get update
docker rmi `docker images -q`
sudo rm -rf /usr/share/dotnet /etc/mysql /etc/php /etc/apt/sources.list.d
sudo -E apt-get -y purge azure-cli ghc* zulu* hhvm llvm* firefox google* dotnet* powershell openjdk* mysql* php*
sudo -E apt-get -y autoremove --purge
sudo -E apt-get clean
echo "======================="
echo "Space usage:"
df -h
@zfdang
Copy link
Author

zfdang commented May 27, 2020

Right now, the GitHub-hosted runners only have 14GB of disk space available , making it insufficient to build larger projects without resorting to using a self-hosted runner

But we can remove unused packages and folder to save disk size for our jobs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment