Skip to content

Delete Branch Cache Action

Actions
GitHub Actions to delete branch caches
v1.0.0
Latest
Star (12)

Delete Branch Cache Action

CI

Deletes GitHub Actions caches for a branch.

Besides if you want to clear the caches for some reason, you can save cache space by deleting the caches you no longer need immediately, because total size of all caches in a repository is limited to 10 GB.

Inputs

Name Description Default Required
repository Target repository name with owner, eg snnaplab/delete-branch-cache-action. Specify when deleting the cache of a repository different from the workflow. ${{ github.repository }} false
ref Git reference of target branch in refs/heads/<branch name> format. To reference a pull request use refs/pull/<number>/merge format. ${{ github.ref }} false
key Delete caches with keys that prefix match the key specified here. If not specified, all caches of the branch specified by ref will be deleted. false
github-token Specify a personal access token (PAT) when targeting a repository different from the workflow. ${{ github.token }} false

Example

Remove unused caches when closing a pull request

Caches created in the HEAD branch of a pull request are no longer used, so delete them immediately to save repository cache space.

name: Delete Unused Caches

on:
  pull_request:
    types: [closed]

jobs:
  delete:
    runs-on: ubuntu-latest
    steps:
      - uses: snnaplab/delete-branch-cache-action@v1
        with:
          # Specify explicitly because the ref at the time of merging will be a branch name such as 'main', 'develop'
          ref: refs/pull/${{ github.event.number }}/merge

License

MIT

Delete Branch Cache Action 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

GitHub Actions to delete branch caches
v1.0.0
Latest

Delete Branch Cache Action 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.