A GitHub Action to optimize the disk space for the GitHub hosted GitHub Actions runner.
This project is inspired from:
Important
- This documentation is v0.8.0 based; To view other version's documentation, please visit the versions list and select the correct version.
- Always continue on error to not breaking any process.
- Support all of the platforms.
- Support multiple types:
- APT caches
- APT packages
- Chocolatey packages
- Directly bundled programs
- Docker caches
- Docker images
- Homebrew caches
- Homebrew packages
- NPM caches
- NPM packages
- OS page/swap file
- Pipx packages
- Windows programs (WMIC)
GitHub | |
---|---|
GitHub Actions | ✔️ |
Note
- It is possible to use this action in other methods/ways which not listed in here, however those methods/ways are not officially supported, and should beware maybe cause security issues.
- GitHub:
hugoalh/disk-space-optimizer-ghaction[@{Tag}]
Note
- It is recommended to use this action with tag for immutability.
This action does not request any GitHub token permission.
Note
- All of the inputs are optional; Use this action without any input will default to do nothing.
Legend Description 🔀 Switch with groups (e.g.: {E}
).
{Boolean = False}
Whether to operate in asynchronously, possibly reduce the operation duration.
{Boolean = False}
Whether to execute this action in sudo mode in order to able operate protected resources on the non-Windows environment.
{RegEx[]}
Remove items which listed in the list, by regular expression of the item name, separate each value per line.
{RegEx[]}
Exclude remove items which listed in the list, by regular expression of the item name, separate each value per line.
{RegEx[]}
Remove Docker images, by regular expression of the Docker image name, separate each value per line.
{RegEx[]}
Exclude remove Docker images, by regular expression of the Docker image name, separate each value per line.
{Boolean = False}
Whether to prune Docker all of the dangling images.
{Boolean = False}
Whether to remove Docker cache, include all of the:
- build caches
- stopped/unused containers
- dangling and/or unreferenced images
- unused networks
🔀{E} {Boolean = False}
Whether to optimize via APT. Only affect items which listed in the list.
If all of the inputs inside this switch group are false
, this input will default to true
.
{Boolean = False}
Whether to prune APT all of the packages that were automatically installed to satisfy dependencies for other packages and are now no longer needed.
{Boolean = False}
Whether to remove APT cache, include the local repository of retrieved package files.
🔀{E} {Boolean = False}
Whether to optimize via Chocolatey. Only affect items which listed in the list.
If all of the inputs inside this switch group are false
, this input will default to true
.
🔀{E} {Boolean = False}
Whether to optimize via Homebrew. Only affect items which listed in the list.
If all of the inputs inside this switch group are false
, this input will default to true
.
{Boolean = False}
Whether to prune Homebrew all of the packages that were only installed as a dependency of other packages and are now no longer needed.
{Boolean = False}
Whether to remove Homebrew cache, include all of the:
- outdated downloads
- old versions of installed formulae
- stale lock files
🔀{E} {Boolean = False}
Whether to optimize via NPM. Only affect items which listed in the list.
If all of the inputs inside this switch group are false
, this input will default to true
.
{Boolean = False}
Whether to prune NPM all of the extraneous packages.
{Boolean = False}
Whether to remove NPM cache.
🔀{E} {Boolean = False}
Whether to optimize via Pipx. Only affect items which listed in the list.
If all of the inputs inside this switch group are false
, this input will default to true
.
🔀{E} {Boolean = False}
Whether to optimize via WMIC. Only affect items which listed in the list.
If all of the inputs inside this switch group are false
, this input will default to true
.
🔀{E} {Boolean = False}
Whether to optimize via file system.
If all of the inputs inside this switch group are false
, this input will default to true
.
{Boolean = False}
Whether to remove system page/swap file.
This action does not have any output.
-
jobs: job_id: runs-on: "ubuntu-latest" steps: - name: "Optimize Disk Space" uses: "hugoalh/[email protected]" with: operate_sudo: "True" general_include: ".+" docker_include: ".+" docker_prune: "True" docker_clean: "True" apt_prune: "True" apt_clean: "True" homebrew_prune: "True" homebrew_clean: "True" npm_prune: "True" npm_clean: "True" os_swap: "True"
- GitHub Actions