Commit graph

29 commits

Author SHA1 Message Date
Babak K. Shandiz
08e4aa892e
test(cache delete): combine test cases for invalid/non-existent refs
Also note that the API never returns HTTP 422 for invalid refs.

Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-08-28 11:07:49 +01:00
Babak K. Shandiz
d1a404a060
test(cache delete): replace HTTP 204 with 200 to match API behaviour
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-08-28 11:06:58 +01:00
Babak K. Shandiz
02d50700b5
docs(cache delete): explain different API responses
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-08-28 11:05:28 +01:00
Babak K. Shandiz
d457a1bce0
test(cache delete): add test case for key arg and --all
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-08-28 10:12:19 +01:00
Babak K. Shandiz
2dd54ae921
refactor(cache delete): simplify error handling
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-08-28 10:08:04 +01:00
Babak K. Shandiz
842d3449b4
refactor(cache delete): simplify condition
Signed-off-by: Babak K. Shandiz <babakks@github.com>
2025-08-28 10:02:03 +01:00
Lucas
926327ce6d
fix(cache): validate --ref flag usage with cache ID
* Ensure that the `--ref` flag cannot be used in conjunction with a cache ID.
* Update error handling to provide clear feedback when this condition is violated.
* Add tests to cover scenarios involving the `--ref` flag and cache ID.
2025-08-27 19:54:19 +02:00
Lucas
1a19918581
fix(cache): prevent using --ref flag with cache ID
* Added validation to ensure that the `--ref` flag cannot be used when a cache ID is provided.
* Updated error message to include the reference when a cache is not found with the specified `--ref`.
2025-08-27 19:38:01 +02:00
Lucas
5c292286cf
refactor(cache): extract cache ID parsing logic
* Replaced direct conversion of cache ID string to int with a dedicated `parseCacheID` function.
* Improved readability and maintainability of the `deleteCaches` function.
2025-08-27 19:37:39 +02:00
Lucas
047326fcb4
fix(cache): update error message for missing cache key with --ref flag
* Changed the error message from "--ref cannot be used without cache key/ID" to "must provide a cache key" for clarity.
* Updated corresponding test case to reflect the new error message.
2025-08-27 04:56:48 +02:00
Lucas
3ba82b58a9
chore(cache): improve help text for --ref flag in cache deletion
* Clarified the description of the `--ref` flag to specify its purpose more accurately.
* Ensures users understand that it narrows down deletion by cache key and ref.
2025-08-27 04:56:48 +02:00
Lucas
bfb1354e51
test(cache): add tests for --ref flag in cache deletion
* Implemented test cases for handling the `--ref` flag in cache deletion commands.
* Added validation for using `--ref` with cache key and ID.
* Ensured proper error messages are returned for invalid usage of `--ref`.
2025-08-27 04:56:48 +02:00
Lucas
aff2bfaa5c
feat(cache): add support for --ref flag in cache deletion
- Introduced `--ref` flag to narrow down cache deletion to a specific branch or PR reference.
- Updated command examples to include usage of `--ref`.
- Added validation to ensure `--ref` cannot be used with `--all` and must accompany a cache key/ID.
2025-08-27 04:56:46 +02:00
Azeem Sajid
9389628323 Update tests 2025-02-19 10:31:20 +05:00
Azeem Sajid
db8e81009c Merge branch '9897-gh-cache-delete-exit-code' of github.com:iamazeem/cli into 9897-gh-cache-delete-exit-code 2025-02-19 10:22:53 +05:00
Azeem Sajid
76efb5ac81 Fix non-TTY case 2025-02-19 10:22:31 +05:00
Azeem Sajid
17e7b57b3b Use API without shorthand flag 2025-02-07 18:03:35 +05:00
Azeem Sajid
a29e74483a Update tests 2025-02-07 17:56:52 +05:00
Azeem Sajid
09ec38e8d7 Update tests 2025-02-06 22:50:26 +05:00
Tyler McGoffin
2f0f387e11
Add test cases for succeed on no cache and api errors for --all (#1) 2025-02-06 22:47:01 +05:00
Azeem Sajid
9e13890c77 Remove short (abbreviated) flag support 2025-02-06 11:56:08 +05:00
Azeem Sajid
d6be4981be Address PR review comments 2025-01-31 12:28:00 +05:00
Azeem Sajid
82ee9a2c75 [gh cache delete --all] Add --succeed-on-no-caches flag to return exit code 0 2025-01-29 14:53:09 +05:00
Kynan Ware
74f13a9b4f
Apply suggestions from code review
Co-authored-by: Andy Feller <andyfeller@github.com>
2024-11-21 13:55:35 -07:00
bagtoad
677ed2cdcf Refactor command documentation to use heredoc 2024-11-21 13:23:03 -07:00
Viktor Szépe
6d9dd57774 Fix typos 2024-05-09 20:15:27 +00:00
Benoit Pierre
564d07ce00 cache/delete: percent-encode keys 2023-09-21 16:32:53 +02:00
Josh Kraft
1dc54f85fb typo 2023-05-03 11:08:32 -06:00
Josh Kraft
213a59b8bd create cache commands 2023-05-03 11:03:50 -06:00