{"id":13563328,"url":"https://github.com/actions/gh-actions-cache","last_synced_at":"2025-10-19T17:30:36.618Z","repository":{"id":50330958,"uuid":"500363954","full_name":"actions/gh-actions-cache","owner":"actions","description":"A GitHub (gh) CLI extension to manage the GitHub Actions caches being used in a GitHub repository.","archived":true,"fork":false,"pushed_at":"2024-10-21T16:20:06.000Z","size":2228,"stargazers_count":305,"open_issues_count":0,"forks_count":59,"subscribers_count":13,"default_branch":"main","last_synced_at":"2024-12-17T00:40:38.727Z","etag":null,"topics":["gh-extension","golang"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/actions.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-06-06T09:09:20.000Z","updated_at":"2024-12-09T15:22:16.000Z","dependencies_parsed_at":"2024-06-19T00:25:38.515Z","dependency_job_id":"0f069f14-fa15-432a-99ca-17ee063c9f6f","html_url":"https://github.com/actions/gh-actions-cache","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/actions%2Fgh-actions-cache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/actions%2Fgh-actions-cache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/actions%2Fgh-actions-cache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/actions%2Fgh-actions-cache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/actions","download_url":"https://codeload.github.com/actions/gh-actions-cache/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237172372,"owners_count":19266660,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gh-extension","golang"],"created_at":"2024-08-01T13:01:17.903Z","updated_at":"2025-10-19T17:30:31.319Z","avatar_url":"https://github.com/actions.png","language":"Go","funding_links":[],"categories":["Go","Github"],"sub_categories":[],"readme":"\u003e [!IMPORTANT]\n\u003e This functionality has been integrated directly into the `gh` CLI\n\u003e\n\u003e https://cli.github.com/manual/gh_cache\n\u003e\n\u003e This extension should be removed and replaced with usage of `gh cache` directly\n\u003e\n\u003e `gh extension remove actions-cache`\n\n# gh-actions-cache\n\n✨ A GitHub (`gh`) [CLI](https://cli.github.com/) extension to manage the GitHub Actions [caches](https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows) being used in a GitHub repository. \n\nIt enables listing of active caches in a repo along with capability to filter by cache key or branch. This brings transparency, for example by showing how much storage quota a cache is consuming or which branch a cache was created for etc or how recently was the cache used.\n\nIt also allows deleting a corrupt, incomplete or dangling cache. A cache can be deleted by cache key. The key can be easily found either using the list capability or by looking at the cache action log in workflow run logs.\n\nThis extension builds on top of [cache management](https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#managing-caches) capabilities exposed by GitHub [APIs](https://docs.github.com/en/rest/actions/cache).\n\n**Note:** This extension only supports github.com and GitHub Enterprise Server 3.7 \u0026 above.\n\n## Installation\n\n1. Install the `gh` CLI - see the [installation](https://github.com/cli/cli#installation)\n   \n   _Installation requires a minimum version (2.0.0) of the GitHub CLI that supports extensions._\n\n2. Install this extension:\n\n        gh extension install actions/gh-actions-cache\n\n## Usage\n\n    gh actions-cache \u003ccommand\u003e [flags]\n\n#### Commands:\n\nS.No  | Commands | Description\n------------- | ------------- | -------------\n1  | list | list caches with result length cap of 100\n2  | delete | delete caches with a key\n\n### List\n\nList active Actions caches in a repository with ability to filter and sort.\n\n``` \nUSAGE:\n\tgh actions-cache list [flags]\n\n\nARGUMENTS:\n\tNo Arguments\n\n\nFLAGS:\n\t-R, --repo \u003c[HOST/]owner/repo\u003e\t\tSelect another repository using the [HOST/]OWNER/REPO format\n\t-B, --branch \u003cstring\u003e\t\t\tFilter by branch\n\t-L, --limit \u003cint\u003e\t\t\tMaximum number of items to fetch (default is 30, max limit is 100)\n\t--key \u003cstring\u003e\t\t\t\tFilter by a key or key prefix\n\t--order \u003cstring\u003e\t\t\tOrder of caches returned (asc/desc)\n\t--sort \u003cstring\u003e\t\t\t\tSort fetched caches (last-used/size/created-at)\n\n\nINHERITED FLAGS\n\t--help\t\tShow help for command\n\n\nEXAMPLES:\n\t$ gh actions-cache list\n\t$ gh actions-cache list --key 564-node-a68c45df0f45f888039d32cd3a579992574e837406488e8904431197f20521d6\n\t$ gh actions-cache list --key 564-node-           // key prefix match\n\t$ gh actions-cache list -B main\n\t$ gh actions-cache list -B refs/pull/2/merge      // Use the full ref format for PR branches\n\t$ gh actions-cache list --limit 100\n\t$ gh actions-cache list --sort size --order desc  // biggest caches first\n```\n\n### Delete \n\nDeletes actions caches with specific cache key. It asks for confirmation before deletion.\n\n```\nUSAGE:\n\tgh actions-cache delete \u003ckey\u003e [flags]\n\n\nARGUMENTS:\n\tkey\t\tcache key which needs to be deleted\n\n\t\nFLAGS:\n\t-R, --repo \u003c[HOST/]owner/repo\u003e\t\tSelect another repository using the [HOST/]OWNER/REPO format\n\t-B, --branch \u003cstring\u003e\t\t\tDelete caches specific to branch. Use the full ref format e.g. refs/heads/main\n\t--confirm\t\t\t\tConfirm deletion without prompting\n\n\nINHERITED FLAGS\n\t--help\t\tShow help for command\n        \n\nEXAMPLES:\n\t$ gh actions-cache delete Linux-node-f5dbf39c9d11eba80242ac13\n```\n\n\n\u003e ℹ️ There could be multiple caches in a repo with same key. This can happen when different caches with same key have been created for different branches. it may also happen if the `version` property of the cache is different which usually means that cache with same key was created for different OS or with different [paths](https://github.com/actions/cache#inputs).\n\n## FAQs\n\n### How the current repository is selected?\n\nThis extension currently uses the `go-gh` module's [`CurrentRepository` function](https://github.com/actions/gh-actions-cache/blob/d3293b69e1c5bc17686d815ab2c64618618c95df/internal/utils.go#L26) to determine the current repo. This function returns the first element of the list returned by the `git.Remotes()` internal function, which [sorts remotes such that `upstream` precedes `github`, which precedes `origin`](https://github.com/cli/go-gh/blob/c2fc965daac88a8a38dd8af02f236095b5dd48f1/internal/git/remote.go#L30). As such, if an `upstream` remote is present, this extension's default behavior is to return its caches. \n\nUser's input `--repo \u003cowner\u003e/\u003cname\u003e` will override any current git repository and extension will fetch caches for the same.\n\n### How to remove trimming in results\n\nWe support a table printer that allows users to pipe output for further processing. If we want to list down certain columns without trimming then just selecting the column number in the below command will work.\n\n`gh actions-cache list -R \u003cowner\u003e/\u003crepo_name\u003e | cut -f 1,2,3`\n\nThis will print columns 1,2 and 3 without any trimming.\n\n### Delete all caches for a branch\n\nPlease refers to this doc - [Force deleting cache entries](https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#force-deleting-cache-entries)\n\n## Contributing\nIf anything feels off, or if you feel that some functionality is missing, please check out the [contributing page](CONTRIBUTING.md). There you will find instructions for sharing your feedback, building the tool locally, and submitting pull requests to the project.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Factions%2Fgh-actions-cache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Factions%2Fgh-actions-cache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Factions%2Fgh-actions-cache/lists"}