Skip to content

hugoalh/disk-space-optimizer-ghaction

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Disk Space Optimizer (GitHub Action)

βš–οΈ MIT

πŸ—‚οΈ GitHub: hugoalh/disk-space-optimizer-ghaction

πŸ†™ Latest Release Version (Latest Release Date)

A GitHub Action to optimize disk space for 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.

🌟 Feature

🎯 Target

  • GitHub Actions Runner

    πŸ›‘οΈ Require Permission

    N/A

    πŸ’½ Require Software

    • PowerShell >= v7.2.0

πŸ”° Usage

Composite Action

  1. Import at the metadata (action.yml):
    runs:
      using: "composite"
      steps:
        - uses: "hugoalh/disk-space-optimizer-ghaction@<Tag>"

Workflow

  1. Import at the workflow (.github/workflows/<WorkflowName>.yml):
    jobs:
      job_id:
        runs-on: "________" # Any
        steps:
          - uses: "hugoalh/disk-space-optimizer-ghaction@<Tag>"

🧩 Input

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}).

operate_async

πŸ§ͺ Experimental

This is in testing, maybe available in the latest version and/or future version.

<Boolean = False> Whether to operate in asynchronously to reduce the operation duration.

operate_sudo

<Boolean = False> Whether to execute this action in sudo mode on non-Windows environment. This can set to True in order to able operate protected resources on non-Windows environment.

general_include

<RegEx[]> Remove general item, by regular expression and general list, separate each value per line.

general_exclude

<RegEx[]> Exclude remove general item, by regular expression and general list, separate each value per line.

docker_include

<RegEx[]> Remove Docker image, by regular expression, separate each value per line.

docker_exclude

<RegEx[]> Exclude remove Docker image, by regular expression, separate each value per line.

docker_prune

<Boolean = False> Whether to prune Docker all of the dangling images.

docker_clean

<Boolean = False> Whether to remove Docker cache, include all of the:

  • build caches
  • stopped/unused containers
  • dangling and/or unreferenced images
  • unused networks

apt_enable

πŸ”€{E} <Boolean = False> Whether to optimize via APT. Only affect general optimization.

If all of the inputs inside this switch group are False, this input will default to True.

apt_prune

<Boolean = False> Whether to prune APT (Advanced Packaging Tools) all of the packages that were automatically installed to satisfy dependencies for other packages and are now no longer needed.

apt_clean

<Boolean = False> Whether to remove APT (Advanced Packaging Tools) cache, include the local repository of retrieved package files.

chocolatey_enable

πŸ”€{E} <Boolean = False> Whether to optimize via Chocolatey. Only affect general optimization.

If all of the inputs inside this switch group are False, this input will default to True.

homebrew_enable

πŸ”€{E} <Boolean = False> Whether to optimize via Homebrew. Only affect general optimization.

If all of the inputs inside this switch group are False, this input will default to True.

homebrew_prune

<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.

homebrew_clean

<Boolean = False> Whether to remove Homebrew cache, include all of the:

  • outdated downloads
  • old versions of installed formulae
  • stale lock files

npm_enable

πŸ”€{E} <Boolean = False> Whether to optimize via NPM. Only affect general optimization.

If all of the inputs inside this switch group are False, this input will default to True.

npm_prune

<Boolean = False> Whether to prune NPM (NodeJS Package Manager) all of the extraneous packages.

npm_clean

<Boolean = False> Whether to remove NPM (NodeJS Package Manager) cache.

pipx_enable

πŸ”€{E} <Boolean = False> Whether to optimize via Pipx. Only affect general optimization.

If all of the inputs inside this switch group are False, this input will default to True.

wmic_enable

πŸ”€{E} <Boolean = False> Whether to optimize via WMIC. Only affect general optimization.

If all of the inputs inside this switch group are False, this input will default to True.

fs_enable

πŸ”€{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.

os_swap

<Boolean = False> Whether to remove system page/swap file.

🧩 Output

N/A

✍️ Example

  • jobs:
      job_id:
        runs-on: "ubuntu-latest"
        steps:
          - name: "Optimize Disk Space"
            uses: "hugoalh/disk-space-optimizer-ghaction@v0.8.0"
            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"

πŸ“š Guide

About

A GitHub Action to optimize disk space for GitHub hosted runner.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published