@@ -1646,9 +1646,13 @@ const getOctokitClient = () => {
16461646const checkIfCacheExists = (cacheKey) => __awaiter(void 0, void 0, void 0, function* () {
16471647 const client = getOctokitClient();
16481648 try {
1649- const issueResult = yield client.request(`/repos/${github_1.context.repo.owner}/${github_1.context.repo.repo}/actions/caches`);
1650- const caches = issueResult.data['actions_caches'] || [];
1651- return Boolean(caches.find(cache => cache['key'] === cacheKey));
1649+ const cachesResult = yield client.rest.actions.getActionsCacheList({
1650+ owner: github_1.context.repo.owner,
1651+ repo: github_1.context.repo.repo,
1652+ key: cacheKey // prefix matching
1653+ });
1654+ const caches = cachesResult.data['actions_caches'] || [];
1655+ return caches.some(cache => cache['key'] === cacheKey);
16521656 }
16531657 catch (error) {
16541658 core.debug(`Error checking if cache exist: ${error.message}`);
@@ -1659,8 +1663,11 @@ const resetCacheWithOctokit = (cacheKey) => __awaiter(void 0, void 0, void 0, fu
16591663 const client = getOctokitClient();
16601664 core.debug(`remove cache "${cacheKey}"`);
16611665 try {
1662- // TODO: replace with client.rest.
1663- yield client.request(`DELETE /repos/${github_1.context.repo.owner}/${github_1.context.repo.repo}/actions/caches?key=${cacheKey}`);
1666+ yield client.rest.actions.deleteActionsCacheByKey({
1667+ owner: github_1.context.repo.owner,
1668+ repo: github_1.context.repo.repo,
1669+ key: cacheKey
1670+ });
16641671 }
16651672 catch (error) {
16661673 if (error.status) {
0 commit comments