gh-cache
manage GitHub Actions workflow caches
TLDR
List caches for the current repository
$ gh cache list
List caches sorted by size$ gh cache list --sort size_in_bytes --order desc
Filter caches by key prefix$ gh cache list --key [key_prefix]
Delete a cache by ID or key$ gh cache delete [cache_id_or_key]
Delete all caches for a specific ref$ gh cache delete --all --ref refs/heads/[branch]
Delete all caches in the repository$ gh cache delete --all
SYNOPSIS
gh cache subcommand [options]
DESCRIPTION
gh cache manages GitHub Actions caches for a repository. Caches store dependencies and build artifacts to speed up workflow execution by reusing data between runs.The cache system uses key-based storage, where workflows save and restore cached data using unique keys. Cache entries have size limits and are automatically evicted based on usage policies. Managing caches manually helps troubleshoot workflow issues and reclaim storage.`gh cache list` can also be invoked as `gh cache ls`.
PARAMETERS
-k, --key prefix
Filter by cache key prefix (list), or match by key (delete).-L, --limit N
Maximum number of caches to fetch (default: 30). (list only)-S, --sort field
Sort by field: createdat, lastaccessedat, sizeinbytes (default: lastaccessed_at). (list only)-O, --order direction
Order of results: asc or desc (default: desc). (list only)-r, --ref ref
Filter or delete by ref, e.g. refs/heads/main or refs/pull/123/merge.-a, --all
Delete all caches. May be combined with --ref to limit scope.--succeed-on-no-caches
Return exit code 0 if no caches are found (used with --all).--json fields
Output JSON with specified fields. (list only)-q, --jq expression
Filter JSON output using a jq expression. (list only)-t, --template format
Format JSON output using a Go template. (list only)-R, --repo owner/repo
Target a specific repository.
SUBCOMMANDS
list
List caches for the current repository.delete
Delete one or more caches by ID, key, or all at once.
