Skip to content

GitHub Action for automatic cleanup of unused GitHub Actions caches. Removes caches from closed pull requests and caches from the main branch that haven't been accessed for a configurable time period. Helps reduce storage usage and improve build performance by keeping the cache environment clean.

License

Notifications You must be signed in to change notification settings

FrankBurmo/cache-cleanup-action

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

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

GitHub Actions Cache Cleanup

GitHub Action for automatic cleanup of unused GitHub Actions caches. Removes caches from closed pull requests and caches from the main branch that haven't been accessed for a configurable time period. Helps reduce storage usage and improve build performance by keeping the cache environment clean.

What it does

  • Deletes caches from closed Pull Requests
  • Deletes caches from the main branch that haven't been used for X days (default: 7)

Sample run

image

How to use

Create a workflow file in your repository (e.g. .github/workflows/cleanup-cache.yml):

name: Expire caches
on:
  schedule:
    # Run every Monday at 00:00
    - cron: '0 0 * * 1'
  workflow_dispatch:
    # Allows for manual workflow runs
permissions:
  actions: write
  pull-requests: read
jobs:
  cleanup:
    runs-on: ubuntu-latest
    
    steps:
      - name: Delete unused caches
        uses: FrankBurmo/cache-cleanup-action@v1.0.0
        with:
          # Optional: Change number of days before main branch caches are deleted (default: 7)
          main-branch-retention-days: '14'

About

GitHub Action for automatic cleanup of unused GitHub Actions caches. Removes caches from closed pull requests and caches from the main branch that haven't been accessed for a configurable time period. Helps reduce storage usage and improve build performance by keeping the cache environment clean.

Resources

License

Stars

Watchers

Forks

Packages

No packages published