|
| 1 | +# more_space |
| 2 | + |
| 3 | +A reusable action to free up GitHub hosted runner space by removing unnecessary files and components. |
| 4 | + |
| 5 | +## Basic Usage |
| 6 | + |
| 7 | +See [action.yml](action.yml) |
| 8 | + |
| 9 | +```yaml |
| 10 | +steps: |
| 11 | + - name: Free Disk Space |
| 12 | + uses: LizardByte/actions/actions/more_space@master |
| 13 | +``` |
| 14 | +
|
| 15 | +## Advanced Usage |
| 16 | +
|
| 17 | +```yaml |
| 18 | +steps: |
| 19 | + - name: Free Disk Space with Analysis |
| 20 | + uses: LizardByte/actions/actions/more_space@master |
| 21 | + with: |
| 22 | + analyze-space-savings: true |
| 23 | + clean-all: true |
| 24 | + safe-packages: "jq,git" |
| 25 | +``` |
| 26 | +
|
| 27 | +## Inputs |
| 28 | +
|
| 29 | +| Name | Description | Default | Required | |
| 30 | +|-----------------------|----------------------------------------------------------------------------------------------|---------|----------| |
| 31 | +| analyze-space-savings | Generate detailed analysis of space savings by each input option | `false` | `false` | |
| 32 | +| clean-all | When true, all inputs except 'safe-packages' are ignored and all cleanup options are enabled | `false` | `false` | |
| 33 | +| safe-packages | A list of packages to keep. If found the cleanup step where found will be sipped | | `false` | |
| 34 | +| remove-android | Remove Android SDK | `false` | `false` | |
| 35 | +| remove-chocolatey | Remove Chocolatey (Windows only) | `false` | `false` | |
| 36 | +| remove-codeql | Remove CodeQL databases | `false` | `false` | |
| 37 | +| remove-docker-images | Remove Docker images | `false` | `false` | |
| 38 | +| remove-docs-linux | Remove /usr/share/doc (Linux only) | `false` | `false` | |
| 39 | +| remove-dotnet | Remove .NET runtime and tools | `false` | `false` | |
| 40 | +| remove-haskell | Remove Haskell | `false` | `false` | |
| 41 | +| remove-homebrew | Remove Homebrew (Linux/macOS only) | `false` | `false` | |
| 42 | +| remove-jvm | Remove JVMs | `false` | `false` | |
| 43 | +| remove-swift | Remove Swift (Linux/macOS only) | `false` | `false` | |
| 44 | +| remove-tool-cache | Remove runner tool cache | `false` | `false` | |
| 45 | +| remove-tools-windows | Remove /c/tools (Windows only) | `false` | `false` | |
| 46 | +| remove-xcode | Remove Xcode (macOS only) | `false` | `false` | |
| 47 | + |
| 48 | +## Outputs |
| 49 | + |
| 50 | +| Name | Description | |
| 51 | +|----------------|----------------------------------------------------------------------------------| |
| 52 | +| space-after | Free disk space after cleanup (GB) | |
| 53 | +| space-analysis | JSON formatted analysis of space savings by input option (sorted by space saved) | |
| 54 | +| space-before | Free disk space before cleanup (GB) | |
| 55 | +| space-saved | Amount of disk space saved (GB) | |
| 56 | + |
| 57 | +## Expected Space Savings |
| 58 | + |
| 59 | +The following table shows the expected space savings for each cleanup option across different runner types. Values are in GB. |
| 60 | + |
| 61 | +| Input Option | ubuntu-22.04 | ubuntu-22.04-arm | ubuntu-24.04 | ubuntu-24.04-arm | windows-2022 | windows-2025 | windows-11-arm | macos-13 | macos-14 | macos-15 | |
| 62 | +|------------------------|--------------|------------------|--------------|------------------|--------------|--------------|----------------|----------|----------|----------| |
| 63 | +| `remove-android` | 8.49 | - | 9.32 | - | FIX | FIX | FIX | 13.15 | 13.06 | 12.20 | |
| 64 | +| `remove-codeql` | 1.54 | - | 1.54 | - | 1.11 | 1.11 | 1.08 | 3.46 | 3.45 | 3.43 | |
| 65 | +| `remove-dotnet` | 1.10 | - | FIX | - | 10.04 | 4.18 | 12.88 | 3.82 | 4.02 | 4.01 | |
| 66 | +| `remove-docker-images` | 3.44 | 3.41 | 0.00 | 0.00 | 10.40 | 0.00 | - | - | - | - | |
| 67 | +| `remove-chocolatey` | - | - | - | - | 2.56 | 2.52 | 2.38 | - | - | - | |
| 68 | +| `remove-docs-linux` | 0.13 | 0.14 | 0.12 | 0.12 | - | - | - | - | - | - | |
| 69 | +| `remove-haskell` | 6.24 | - | 6.24 | - | 10.02 | 3.65 | - | TODO | TODO | TODO | |
| 70 | +| `remove-homebrew` | 0.18 | - | 0.18 | - | - | - | - | 1.65 | 7.36 | 7.84 | |
| 71 | +| `remove-jvm` | 1.14 | 1.14 | 1.13 | 1.14 | 1.10 | 1.10 | 0.58 | 1.08 | 0.91 | 0.92 | |
| 72 | +| `remove-swift` | 2.70 | 2.68 | 2.71 | 2.68 | - | - | - | 0.44 | 0.44 | 0.49 | |
| 73 | +| `remove-tool-cache` | 3.84 | - | 3.47 | - | 3.53 | 2.42 | 1.68 | 2.62 | 1.45 | 1.43 | |
| 74 | +| `remove-tools-windows` | - | - | - | - | 0.22 | 0.22 | 0.21 | - | - | - | |
| 75 | +| `remove-xcode` | - | - | - | - | - | - | - | 49.88 | 35.14 | 28.99 | |
| 76 | +| Linux package cleanup | 0.08 | 0.18 | 0.03 | 0.13 | - | - | - | - | - | - | |
| 77 | +| Total saved | 28.88 | 7.55 | 24.74 | 4.07 | 38.98 | 15.20 | 18.81 | 76.10 | 65.83 | 59.31 | |
| 78 | + |
| 79 | +## Examples |
| 80 | + |
| 81 | +### Clean Everything |
| 82 | + |
| 83 | +```yaml |
| 84 | +- name: Free Maximum Disk Space |
| 85 | + uses: LizardByte/actions/actions/more_space@master |
| 86 | + with: |
| 87 | + clean-all: true |
| 88 | +``` |
| 89 | + |
| 90 | +### Target Specific Components |
| 91 | + |
| 92 | +```yaml |
| 93 | +- name: Free Disk Space for Container Build |
| 94 | + uses: LizardByte/actions/actions/more_space@master |
| 95 | + with: |
| 96 | + remove-docker-images: true |
| 97 | + remove-dotnet: true |
| 98 | + remove-android: true |
| 99 | +``` |
| 100 | + |
| 101 | +### Analyze Space Usage |
| 102 | + |
| 103 | +```yaml |
| 104 | +- name: Analyze Disk Space Usage |
| 105 | + uses: LizardByte/actions/actions/more_space@master |
| 106 | + with: |
| 107 | + analyze-space-savings: true |
| 108 | + clean-all: true |
| 109 | + |
| 110 | +- name: Display Analysis |
| 111 | + run: echo '${{ steps.cleanup.outputs.space-analysis }}' |
| 112 | +``` |
| 113 | + |
| 114 | +## Safe Package Protection |
| 115 | + |
| 116 | +When using `safe-packages`, the action will: |
| 117 | + |
| 118 | +1. Locate the specified packages using system commands (`which`, `where`) |
| 119 | +2. Check if any cleanup target contains these packages |
| 120 | +3. Skip removal of directories containing protected packages |
| 121 | +4. Continue with other cleanup operations |
| 122 | + |
| 123 | +This ensures critical tools remain available after cleanup. |
0 commit comments