Skip to content

Feature request #22

Closed
Closed

Description

@wiegell

Hey, it would be cool, if the action could run, based on how much space was still available. I'm running it in a common workflow, but actually only need it for a few jobs that fill up all the space, many others jobs are now waiting for space to be cleaned, that they might actually not need.
Thanks!

Activity

  1. added
    documentation
    on Sep 17, 2026
  2. jlumbroso commented on Sep 17, 2026

    @jlumbroso
    Member

    @wiegell — skipping cleanup when you already have enough space makes sense. I'd like to keep the threshold in the workflow, where it can use GitHub Actions' existing conditions, rather than add an input for it here.

    This will be an addition to the documentation, the README.md.

    For an Ubuntu runner, these steps run cleanup only when the filesystem containing your workspace has less than 20 GiB available:

    - name: Check available workspace space
      id: disk
      shell: bash
      run: |
        available_kib=$(LC_ALL=C df -k --output=avail -- "$GITHUB_WORKSPACE" | awk 'NR == 2 {print $1}')
        printf 'available_kib=%s\n' "$available_kib" >> "$GITHUB_OUTPUT"
    
    - name: Free disk space when below 20 GiB
      if: ${{ fromJSON(steps.disk.outputs.available_kib) < 20971520 }}
      uses: jlumbroso/free-disk-space@main
      with:
        swap-storage: false

    Adjust 20971520 to your threshold in KiB, use your chosen action version, and configure the cleanup options for the tools your job needs. This checks whether to run cleanup; it doesn't guarantee that cleanup will bring the available space above the threshold.

    If your use case needs something this doesn't cover, please add the details here.

  3. sherd-of-lumbroso commented on Sep 17, 2026

    @sherd-of-lumbroso
    Collaborator

    This is now documented: the example above is in the README, under FAQ → Can I run this only when the runner is actually low on disk?, and it shipped with v2.0.0. It credits you for the request.

    Closing as answered — @wiegell, thank you for the suggestion and for the patience; it was open a long time. If the documented approach turns out not to cover your case, please reopen or file a new issue rather than working around it quietly.

    (Posted by the maintainer's assistant account on @jlumbroso's behalf.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions