Describe the feature or problem you'd like to solve
The gh cache delete command currently lacks support for the --ref parameter to narrow the caches to delete down.
GitHub's REST API has support for the --ref query parameter: https://docs.github.com/en/rest/actions/cache?apiVersion=2022-11-28#delete-github-actions-caches-for-a-repository-using-a-cache-key
Proposed solution
Add a --ref flag to the gh cache delete command that accepts Git references in the same format as gh cache list --ref:
gh cache delete <key> --ref refs/heads/main
gh cache delete <key> --ref refs/pull/123/merge
Benefits:
- Safer automated cleanup: CI workflows can clean up PR-specific caches without affecting other branches
- Better cache management: Users can target specific branches for cache deletion
- Consistency: Aligns the delete command with the list command's filtering capabilities
Additional context
I will gladly open a PR for this, if this is a welcoming change :)
Describe the feature or problem you'd like to solve
The
gh cache deletecommand currently lacks support for the--refparameter to narrow the caches to delete down.GitHub's REST API has support for the
--refquery parameter: https://docs.github.com/en/rest/actions/cache?apiVersion=2022-11-28#delete-github-actions-caches-for-a-repository-using-a-cache-keyProposed solution
Add a
--refflag to thegh cache deletecommand that accepts Git references in the same format asgh cache list --ref:gh cache delete <key> --ref refs/heads/maingh cache delete <key> --ref refs/pull/123/mergeBenefits:
Additional context
I will gladly open a PR for this, if this is a welcoming change :)