name: 'Free Disk Space'
description: 'Free up disk space by removing large preinstalled items and cleaning up Docker'

runs:
  using: "composite"
  steps:
    - name: Free disk space (Linux only)
      if: runner.os == 'Linux'
      shell: bash
      run: |
        echo "Disk usage before cleanup:"
        df -h

        # Remove large preinstalled items that are not used on GitHub-hosted runners
        sudo rm -rf /usr/share/dotnet || true
        sudo rm -rf /opt/ghc || true
        sudo rm -rf /usr/local/lib/android || true

        # Clean up Docker
        docker system prune -af || true
        docker volume prune -f || true

        echo "Disk usage after cleanup:"
        df -h