-
Notifications
You must be signed in to change notification settings - Fork 7.8k
feat(cache delete): allow for delete all caches for a ref #12101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Hi! Thanks for the pull request. Please ensure that this change is linked to an issue by mentioning an issue number in the description of the pull request. If this pull request would close the issue, please put the word 'Fixes' before the issue number somewhere in the pull request body. If this is a tiny change like fixing a typo, feel free to ignore this message. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for using the --ref flag in conjunction with --all when deleting caches, allowing users to delete all caches for a specific git reference (branch or PR).
- Removed the mutual exclusivity check that prevented
--refand--allfrom being used together - Updated validation logic to allow
--refwith--allbut still require a cache key when--refis used without--all - Modified
deleteRunto pass the ref parameter toGetCacheswhen deleting all caches for a specific ref
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
47d8f2f to
e8c586f
Compare
|
Thank you for your pull request! 🎉 This PR appears to fix the following issues that are not labeled with
help wanted
As outlined in our Contributing Guidelines, we expect that PRs are only created for issues that have been labeled While we appreciate your initiative, please note that:
What happens next:
Thank you for your understanding and contribution to the project! 🙏 This comment was automatically generated by cliAutomation. |
e8c586f to
fb28c59
Compare
|
Closing as explained in #12102 (comment). |
c474b26 to
28361b3
Compare
Signed-off-by: David van der Spek <david.vanderspek@flyrlabs.com>
Signed-off-by: David van der Spek <david.vanderspek@flyrlabs.com>
28361b3 to
9cdc0c4
Compare
BagToad
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me @davidspek! Thank you for your patience, proposing this idea, and implementing it!
This MR contains the following updates: | Package | Update | Change | |---|---|---| | [cli/cli](https://github.com/cli/cli) | minor | `v2.85.0` → `v2.86.0` | MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot). **Proposed changes to behavior should be submitted there as MRs.** --- ### Release Notes <details> <summary>cli/cli (cli/cli)</summary> ### [`v2.86.0`](https://github.com/cli/cli/releases/tag/v2.86.0): GitHub CLI 2.86.0 [Compare Source](cli/cli@v2.85.0...v2.86.0) ####Install and run GitHub Copilot CLI directly from `gh` Since we deprecated the [GitHub Copilot in the CLI](https://github.blog/changelog/2025-09-25-upcoming-deprecation-of-gh-copilot-cli-extension/) extension in favor of the new agentic [GitHub Copilot CLI](https://github.com/github/copilot-cli), we want to give developers using `gh` a simple way to get started using our most powerful terminal assistant. - `gh copilot` will prompt to install, then run Copilot CLI - `gh copilot <args>` will execute the Copilot CLI, forwarding any arguments and flags For more information and usage options, run `gh copilot --help`. #### What's Changed ##### ✨ Features - `gh copilot`: add native `copilot` command to execute/install copilot cli by [@​devm33](https://github.com/devm33) in [#​12444](cli/cli#12444) - `gh cache delete`: allow for delete all caches for a ref by [@​davidspek](https://github.com/davidspek) in [#​12101](cli/cli#12101) - `gh pr create`: error when head and base refs are identical in pr create by [@​majiayu000](https://github.com/majiayu000) in [#​12376](cli/cli#12376) ##### 📚 Docs & Chores - Fix Windows asset URL in `copilot` command tests by [@​babakks](https://github.com/babakks) in [#​12500](cli/cli#12500) - Update contributing guidelines for clarity by [@​BagToad](https://github.com/BagToad) in [#​12505](cli/cli#12505) #### New Contributors - [@​devm33](https://github.com/devm33) made their first contribution in [#​12444](cli/cli#12444) - [@​davidspek](https://github.com/davidspek) made their first contribution in [#​12101](cli/cli#12101) **Full Changelog**: <cli/cli@v2.85.0...v2.86.0> </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this MR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box --- This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi44Ni4xIiwidXBkYXRlZEluVmVyIjoiNDIuODYuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiUmVub3ZhdGUgQm90IiwiYXV0b21hdGlvbjpib3QtYXV0aG9yZWQiLCJkZXBlbmRlbmN5LXR5cGU6Om1pbm9yIl19-->
Fixes #12102
To cleanup caches from PR branches once they are merged, the current approach is to create a script that list all the caches for the PR ref, gets the IDs, and then iterate through each ID to delete the cache. This approach is also used in the official GitHub documentation. Having to do this scripting and choosing some number for the limit of caches to fetch, which might not include everything, seems needlessly complex.
This PR adds the capability to pass both
--alland--ref, making cleaning up all the caches after a PR is merged as simple asgh cache delete --all --ref refs/pull/<PR-number>/merge.