You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thank you for your issue! We have categorized it as a feature request, and it has been added to our backlog. In doing so, we are not committing to implementing this feature at this time, but, we will consider it for future releases based on community feedback and our own product roadmap.
Unless you see the
help wantedContributions welcome
label, we are not currently looking for external contributions for this feature.
If you come across this issue and would like to see it implemented, please add a thumbs up! This will help us prioritize the feature. Please only comment if you have additional information or viewpoints to contribute.
I can see the value to this addition as it'll allow users to purge a specific piece of a cache entry.
Please be aware that as with any
enhancementa request to improve CLI
issues, we need to discuss this internally and finalise an A/C for it. So, I'm going to lay out the context needed for discussion.
Investigations
It's a pretty straightforward change:
The ref query parameter is also supported on GHES v3.14 (if not earlier), so there's no feature detection required for this change.
The ref field is already present in the cache list --json output, so no need to touch that command.
Thanks for your interest in helping us, @Cpoing! 🙏
However, the issue is not marked as
help wantedContributions welcome
, which means the team has yet to decide if this should be picked up by our community. Please follow this issue for future updates.
@luxass@Cpoing I'm going to put down the A/C for this change and mark it as
help wantedContributions welcome
. Since both of you folks have kindly expressed interest in submitting a PR for this, to avoid working in parallel, please comment here if any of you are going to work on this. 🙏
Regardless of who is going to make the PR, I want to appreciate your help and your will to make gh better. ❤️
When I run gh cache delete <key> with a valid/existing <key> Then the cached data associated with the given <key> is deleted
2. Delete with --ref
When I run gh cache delete <key> --ref <ref> with a valid/existing <key> and <ref> values Then the cached data associated with the given <ref> and <key> is deleted
3. Invalid --ref value
When I run gh cache delete <key> --ref <ref> with an invalid <ref> value Then I get the error returned by the API call
Note
This is probably going to be done already. I'm just repeating to hint at that we don't need to perform client-side validation (as we don't in cache list). This is to make the experience consistent with the cache list command, and also keep gh forward-compatible if the API changes in favour of accepting non-full refs (e.g. a branch name or PR number). FWIW I've seen API endpoints that behave like this.
4. Invalid option usages
4.1. Use with no arg (i.e. cache key/ID)
When I run gh cache delete --ref <ref> Then I get an error saying --ref cannot be used without cache key/ID
4.2. Use with --all
When I run gh cache delete --all --ref <ref> Then I get an error saying --ref cannot be used with --all
5. Docs
When I run gh cache delete --help Then I see the docs include the --ref option with examples:
FLAGS
-r, --ref string Narrow down deletion to a specific ref, formatted as refs/heads/<branch name> or refs/pull/<number>/merge
EXAMPLES
# Delete a cache by key and branch ref
$ gh cache delete cache-key --ref refs/heads/feature-branch
# Delete a cache by key and PR ref
$ gh cache delete cache-key --ref refs/pull/<PR-number>/merge
Note
The examples should be put where it makes sense (i.e. not just at the end).
@babakks I'd like to take this on - I've already started working on some of the implementation locally. I should be able to get a PR up within the next few hours.
Activity
github-actions commentedon Jul 31, 2025
Thank you for your issue! We have categorized it as a feature request, and it has been added to our backlog. In doing so, we are not committing to implementing this feature at this time, but, we will consider it for future releases based on community feedback and our own product roadmap.
Unless you see the help wantedContributions welcome
label, we are not currently looking for external contributions for this feature.
If you come across this issue and would like to see it implemented, please add a thumbs up! This will help us prioritize the feature. Please only comment if you have additional information or viewpoints to contribute.
[-]Support --ref parameter in gh cache delete[/-][+]Support `--ref` parameter in `gh cache delete`[/+]babakks commentedon Aug 4, 2025
Hi @luxass, and thanks for the nice suggestion! 🙏
I can see the value to this addition as it'll allow users to purge a specific piece of a cache entry.
Please be aware that as with any enhancementa request to improve CLI
issues, we need to discuss this internally and finalise an A/C for it. So, I'm going to lay out the context needed for discussion.
Investigations
It's a pretty straightforward change:
refquery parameter is also supported on GHES v3.14 (if not earlier), so there's no feature detection required for this change.reffield is already present in thecache list --jsonoutput, so no need to touch that command.Cpoing commentedon Aug 14, 2025
Hi! I’d like to work on this as a first-time contributor if that’s okay.
babakks commentedon Aug 14, 2025
Thanks for your interest in helping us, @Cpoing! 🙏
However, the issue is not marked as help wantedContributions welcome
, which means the team has yet to decide if this should be picked up by our community. Please follow this issue for future updates.
babakks commentedon Aug 26, 2025
@luxass @Cpoing I'm going to put down the A/C for this change and mark it as help wantedContributions welcome
. Since both of you folks have kindly expressed interest in submitting a PR for this, to avoid working in parallel, please comment here if any of you are going to work on this. 🙏
Regardless of who is going to make the PR, I want to appreciate your help and your will to make
ghbetter. ❤️babakks commentedon Aug 26, 2025
Acceptance Criteria
1. Existing behaviour
When I run
gh cache delete <key>with a valid/existing<key>Then the cached data associated with the given
<key>is deleted2. Delete with
--refWhen I run
gh cache delete <key> --ref <ref>with a valid/existing<key>and<ref>valuesThen the cached data associated with the given
<ref>and<key>is deleted3. Invalid
--refvalueWhen I run
gh cache delete <key> --ref <ref>with an invalid<ref>valueThen I get the error returned by the API call
Note
This is probably going to be done already. I'm just repeating to hint at that we don't need to perform client-side validation (as we don't in
cache list). This is to make the experience consistent with thecache listcommand, and also keepghforward-compatible if the API changes in favour of accepting non-full refs (e.g. a branch name or PR number). FWIW I've seen API endpoints that behave like this.4. Invalid option usages
4.1. Use with no arg (i.e. cache key/ID)
When I run
gh cache delete --ref <ref>Then I get an error saying
--refcannot be used without cache key/ID4.2. Use with
--allWhen I run
gh cache delete --all --ref <ref>Then I get an error saying
--refcannot be used with--all5. Docs
When I run
gh cache delete --helpThen I see the docs include the
--refoption with examples:Note
The examples should be put where it makes sense (i.e. not just at the end).
luxass commentedon Aug 26, 2025
@babakks I'd like to take this on - I've already started working on some of the implementation locally. I should be able to get a PR up within the next few hours.
babakks commentedon Aug 26, 2025
Thanks, @luxass! It's great! I'm looking forward to it.