From 02d50700b52ae52f87cd4e3b84f805683fc7728c Mon Sep 17 00:00:00 2001 From: "Babak K. Shandiz" Date: Thu, 28 Aug 2025 11:05:28 +0100 Subject: [PATCH] docs(cache delete): explain different API responses Signed-off-by: Babak K. Shandiz --- pkg/cmd/cache/delete/delete.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pkg/cmd/cache/delete/delete.go b/pkg/cmd/cache/delete/delete.go index 227b518a6..58281d831 100644 --- a/pkg/cmd/cache/delete/delete.go +++ b/pkg/cmd/cache/delete/delete.go @@ -167,6 +167,18 @@ func deleteCaches(opts *DeleteOptions, client *api.Client, repo ghrepo.Interface base := fmt.Sprintf("repos/%s/actions/caches", repoName) for _, cache := range toDelete { + // TODO(babakks): We use two different endpoints here which have different + // response schemas: + // + // 1. /repos/OWNER/REPO/actions/caches/ID (for deleting by cache ID) + // - returns HTTP 204 (NO CONTENT) on success + // 2. /repos/OWNER/REPO/actions/caches?key=KEY[&ref=REF] (for deleting by cache key, and optionally a ref) + // - returns HTTP 200 on success including information about the deleted caches + // + // So, if/when we decided to use the data in the response body we need + // to be careful with parsing. Probably want to split these API calls + // into separate functions. + path := "" if id, ok := parseCacheID(cache); ok { path = fmt.Sprintf("%s/%d", base, id)