Skip to content

Clean Cache

Actions
Cleans up caches for GitHub Actions based on branch or PR ref
v1.1.0
Latest
Star (1)

Clean Cache Action

Cleans up caches for GitHub Actions by their keys or branches.

The action is designed to be used in two scenarios with minimal setup necessary:

  • on push branch event, where it can delete obsolete cache entries
  • on PR close event, where it can delete all cache entries belonging to the branch

Examples

Keep only most recent cache while working on a branch

on:
  push:
    branches: ['**']

jobs:
  clean:
    runs-on: ubuntu-latest
    permissions:
      actions: write
    steps:
      - uses: opengrabeso/clean-cache@v2.1.0
        with:  
          post: true
          keep: 1
name: PR Cleanup
on:
  pull_request:
    types:
      - closed

jobs:
  cleanup:
    runs-on: ubuntu-latest
    permissions:
      actions: write
      contents: read
      pull-requests: read
    steps:

      - name: Clean cache for the branch name
        uses: opengrabeso/clean-cache@v2.1.0

Clean Cache is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.

About

Cleans up caches for GitHub Actions based on branch or PR ref
v1.1.0
Latest

Clean Cache is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.