diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f3aa097087de..7086341742f9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -810,6 +810,19 @@ jobs: uses: actions/checkout@v7 with: ref: ${{ env.HEAD_COMMIT }} + - name: Free up disk space if low + # The full suite pulls several DB docker images (mssql alone is ~1.5GB) + # Available disk space is not consistent, if we detect low space this cleans up some unused toolchains + run: | + df -h / + avail_kb=$(df -k --output=avail / | tail -1) + if [ "$avail_kb" -lt $((40 * 1024 * 1024)) ]; then + echo "Low disk space (<40GB free) — reclaiming unused toolchains" + sudo rm -rf /usr/local/lib/android /usr/share/dotnet /opt/ghc /usr/local/.ghcup /opt/hostedtoolcache/CodeQL + df -h / + else + echo "Sufficient disk space — skipping cleanup" + fi - name: Set up Node uses: actions/setup-node@v6 with: