3
0
Fork 0
mirror of https://code.forgejo.org/actions/cache.git synced 2025-04-29 22:55:52 +00:00

Fix script invocations, lint and format.

Signed-off-by: Gregorio Litenstein <g.litenstein@gmail.com>
This commit is contained in:
Gregorio Litenstein 2025-04-25 18:44:18 -04:00
parent 8ac3d1967f
commit 11a6324cc7
No known key found for this signature in database
GPG key ID: 4EB52A1A9CE2C63F
8 changed files with 240 additions and 175 deletions

View file

@ -7,5 +7,6 @@
"trailingComma": "none",
"bracketSpacing": true,
"arrowParens": "avoid",
"parser": "typescript"
"parser": "typescript",
"endOfLine": "lf"
}

View file

@ -75634,9 +75634,9 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.isCacheFeatureAvailable = exports.getInputAsBool = exports.getInputAsInt = exports.getInputAsArray = exports.isValidEvent = exports.deleteCacheByKey = exports.logWarning = exports.isExactKeyMatch = exports.isGhes = void 0;
const cache = __importStar(__nccwpck_require__(5116));
const core = __importStar(__nccwpck_require__(7484));
const action_1 = __nccwpck_require__(8556);
const request_error_1 = __nccwpck_require__(3708);
const constants_1 = __nccwpck_require__(7242);
const { Octokit } = __nccwpck_require__(8556);
function isGhes() {
const ghUrl = new URL(process.env["GITHUB_SERVER_URL"] || "https://github.com");
const hostname = ghUrl.hostname.trimEnd().toUpperCase();
@ -75661,18 +75661,19 @@ exports.logWarning = logWarning;
function deleteCacheByKey(key, owner, repo) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
const octokit = new Octokit();
const octokit = new action_1.Octokit();
let response;
try {
const gitRef = process.env[constants_1.RefKey];
let cacheEntry = yield octokit.rest.actions.getActionsCacheList({
const cacheEntry = yield octokit.rest.actions.getActionsCacheList({
owner: owner,
repo: repo,
key: key,
ref: gitRef
});
const { data: { total_count, actions_caches } } = cacheEntry;
if (total_count !== 1 || total_count !== actions_caches.length) { // leave all find logic to the actual cache implementation. We just want to make sure we're returned a single element so we don't accidentally delete an entry that belongs to a different gitref.
if (total_count !== 1 || total_count !== actions_caches.length) {
// leave all find logic to the actual cache implementation. We just want to make sure we're returned a single element so we don't accidentally delete an entry that belongs to a different gitref.
if (total_count > 1) {
exports.logWarning(`More than one cache entry found for key ${key}`);
}
@ -75687,22 +75688,25 @@ function deleteCacheByKey(key, owner, repo) {
core.info(`Skip trying to delete cache entry for key ${key}.`);
return;
}
let id = actions_caches[0].id;
response = yield octokit.rest.actions.deleteActionsCacheById({
owner: owner,
repo: repo,
cache_id: id
});
if (response.status === 204) {
core.info(`Succesfully deleted cache with key: ${key}, id: ${id}`);
return 204;
const id = actions_caches[0].id;
if (id) {
response = yield octokit.rest.actions.deleteActionsCacheById({
owner: owner,
repo: repo,
cache_id: id
});
if (response.status === 204) {
core.info(`Succesfully deleted cache with key: ${key}, id: ${id}`);
return 204;
}
}
}
catch (e) {
if (e instanceof request_error_1.RequestError) {
let err = e;
let errData = (_a = err.response) === null || _a === void 0 ? void 0 : _a.data;
exports.logWarning(`Github API reported error: ${err.name} '${err.status}: ${errData === null || errData === void 0 ? void 0 : errData.message}'`);
const err = e;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const errMessage = ((_a = err.response) === null || _a === void 0 ? void 0 : _a.data).message;
exports.logWarning(`Github API reported error: ${err.name} '${err.status}: ${errMessage}'`);
}
core.info(`Couldn't delete cache entry for key ${key}.`);
return;

36
dist/restore/index.js vendored
View file

@ -75634,9 +75634,9 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.isCacheFeatureAvailable = exports.getInputAsBool = exports.getInputAsInt = exports.getInputAsArray = exports.isValidEvent = exports.deleteCacheByKey = exports.logWarning = exports.isExactKeyMatch = exports.isGhes = void 0;
const cache = __importStar(__nccwpck_require__(5116));
const core = __importStar(__nccwpck_require__(7484));
const action_1 = __nccwpck_require__(8556);
const request_error_1 = __nccwpck_require__(3708);
const constants_1 = __nccwpck_require__(7242);
const { Octokit } = __nccwpck_require__(8556);
function isGhes() {
const ghUrl = new URL(process.env["GITHUB_SERVER_URL"] || "https://github.com");
const hostname = ghUrl.hostname.trimEnd().toUpperCase();
@ -75661,18 +75661,19 @@ exports.logWarning = logWarning;
function deleteCacheByKey(key, owner, repo) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
const octokit = new Octokit();
const octokit = new action_1.Octokit();
let response;
try {
const gitRef = process.env[constants_1.RefKey];
let cacheEntry = yield octokit.rest.actions.getActionsCacheList({
const cacheEntry = yield octokit.rest.actions.getActionsCacheList({
owner: owner,
repo: repo,
key: key,
ref: gitRef
});
const { data: { total_count, actions_caches } } = cacheEntry;
if (total_count !== 1 || total_count !== actions_caches.length) { // leave all find logic to the actual cache implementation. We just want to make sure we're returned a single element so we don't accidentally delete an entry that belongs to a different gitref.
if (total_count !== 1 || total_count !== actions_caches.length) {
// leave all find logic to the actual cache implementation. We just want to make sure we're returned a single element so we don't accidentally delete an entry that belongs to a different gitref.
if (total_count > 1) {
exports.logWarning(`More than one cache entry found for key ${key}`);
}
@ -75687,22 +75688,25 @@ function deleteCacheByKey(key, owner, repo) {
core.info(`Skip trying to delete cache entry for key ${key}.`);
return;
}
let id = actions_caches[0].id;
response = yield octokit.rest.actions.deleteActionsCacheById({
owner: owner,
repo: repo,
cache_id: id
});
if (response.status === 204) {
core.info(`Succesfully deleted cache with key: ${key}, id: ${id}`);
return 204;
const id = actions_caches[0].id;
if (id) {
response = yield octokit.rest.actions.deleteActionsCacheById({
owner: owner,
repo: repo,
cache_id: id
});
if (response.status === 204) {
core.info(`Succesfully deleted cache with key: ${key}, id: ${id}`);
return 204;
}
}
}
catch (e) {
if (e instanceof request_error_1.RequestError) {
let err = e;
let errData = (_a = err.response) === null || _a === void 0 ? void 0 : _a.data;
exports.logWarning(`Github API reported error: ${err.name} '${err.status}: ${errData === null || errData === void 0 ? void 0 : errData.message}'`);
const err = e;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const errMessage = ((_a = err.response) === null || _a === void 0 ? void 0 : _a.data).message;
exports.logWarning(`Github API reported error: ${err.name} '${err.status}: ${errMessage}'`);
}
core.info(`Couldn't delete cache entry for key ${key}.`);
return;

View file

@ -75672,9 +75672,9 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.isCacheFeatureAvailable = exports.getInputAsBool = exports.getInputAsInt = exports.getInputAsArray = exports.isValidEvent = exports.deleteCacheByKey = exports.logWarning = exports.isExactKeyMatch = exports.isGhes = void 0;
const cache = __importStar(__nccwpck_require__(5116));
const core = __importStar(__nccwpck_require__(7484));
const action_1 = __nccwpck_require__(8556);
const request_error_1 = __nccwpck_require__(3708);
const constants_1 = __nccwpck_require__(7242);
const { Octokit } = __nccwpck_require__(8556);
function isGhes() {
const ghUrl = new URL(process.env["GITHUB_SERVER_URL"] || "https://github.com");
const hostname = ghUrl.hostname.trimEnd().toUpperCase();
@ -75699,18 +75699,19 @@ exports.logWarning = logWarning;
function deleteCacheByKey(key, owner, repo) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
const octokit = new Octokit();
const octokit = new action_1.Octokit();
let response;
try {
const gitRef = process.env[constants_1.RefKey];
let cacheEntry = yield octokit.rest.actions.getActionsCacheList({
const cacheEntry = yield octokit.rest.actions.getActionsCacheList({
owner: owner,
repo: repo,
key: key,
ref: gitRef
});
const { data: { total_count, actions_caches } } = cacheEntry;
if (total_count !== 1 || total_count !== actions_caches.length) { // leave all find logic to the actual cache implementation. We just want to make sure we're returned a single element so we don't accidentally delete an entry that belongs to a different gitref.
if (total_count !== 1 || total_count !== actions_caches.length) {
// leave all find logic to the actual cache implementation. We just want to make sure we're returned a single element so we don't accidentally delete an entry that belongs to a different gitref.
if (total_count > 1) {
exports.logWarning(`More than one cache entry found for key ${key}`);
}
@ -75725,22 +75726,25 @@ function deleteCacheByKey(key, owner, repo) {
core.info(`Skip trying to delete cache entry for key ${key}.`);
return;
}
let id = actions_caches[0].id;
response = yield octokit.rest.actions.deleteActionsCacheById({
owner: owner,
repo: repo,
cache_id: id
});
if (response.status === 204) {
core.info(`Succesfully deleted cache with key: ${key}, id: ${id}`);
return 204;
const id = actions_caches[0].id;
if (id) {
response = yield octokit.rest.actions.deleteActionsCacheById({
owner: owner,
repo: repo,
cache_id: id
});
if (response.status === 204) {
core.info(`Succesfully deleted cache with key: ${key}, id: ${id}`);
return 204;
}
}
}
catch (e) {
if (e instanceof request_error_1.RequestError) {
let err = e;
let errData = (_a = err.response) === null || _a === void 0 ? void 0 : _a.data;
exports.logWarning(`Github API reported error: ${err.name} '${err.status}: ${errData === null || errData === void 0 ? void 0 : errData.message}'`);
const err = e;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const errMessage = ((_a = err.response) === null || _a === void 0 ? void 0 : _a.data).message;
exports.logWarning(`Github API reported error: ${err.name} '${err.status}: ${errMessage}'`);
}
core.info(`Couldn't delete cache entry for key ${key}.`);
return;

36
dist/save/index.js vendored
View file

@ -75672,9 +75672,9 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.isCacheFeatureAvailable = exports.getInputAsBool = exports.getInputAsInt = exports.getInputAsArray = exports.isValidEvent = exports.deleteCacheByKey = exports.logWarning = exports.isExactKeyMatch = exports.isGhes = void 0;
const cache = __importStar(__nccwpck_require__(5116));
const core = __importStar(__nccwpck_require__(7484));
const action_1 = __nccwpck_require__(8556);
const request_error_1 = __nccwpck_require__(3708);
const constants_1 = __nccwpck_require__(7242);
const { Octokit } = __nccwpck_require__(8556);
function isGhes() {
const ghUrl = new URL(process.env["GITHUB_SERVER_URL"] || "https://github.com");
const hostname = ghUrl.hostname.trimEnd().toUpperCase();
@ -75699,18 +75699,19 @@ exports.logWarning = logWarning;
function deleteCacheByKey(key, owner, repo) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
const octokit = new Octokit();
const octokit = new action_1.Octokit();
let response;
try {
const gitRef = process.env[constants_1.RefKey];
let cacheEntry = yield octokit.rest.actions.getActionsCacheList({
const cacheEntry = yield octokit.rest.actions.getActionsCacheList({
owner: owner,
repo: repo,
key: key,
ref: gitRef
});
const { data: { total_count, actions_caches } } = cacheEntry;
if (total_count !== 1 || total_count !== actions_caches.length) { // leave all find logic to the actual cache implementation. We just want to make sure we're returned a single element so we don't accidentally delete an entry that belongs to a different gitref.
if (total_count !== 1 || total_count !== actions_caches.length) {
// leave all find logic to the actual cache implementation. We just want to make sure we're returned a single element so we don't accidentally delete an entry that belongs to a different gitref.
if (total_count > 1) {
exports.logWarning(`More than one cache entry found for key ${key}`);
}
@ -75725,22 +75726,25 @@ function deleteCacheByKey(key, owner, repo) {
core.info(`Skip trying to delete cache entry for key ${key}.`);
return;
}
let id = actions_caches[0].id;
response = yield octokit.rest.actions.deleteActionsCacheById({
owner: owner,
repo: repo,
cache_id: id
});
if (response.status === 204) {
core.info(`Succesfully deleted cache with key: ${key}, id: ${id}`);
return 204;
const id = actions_caches[0].id;
if (id) {
response = yield octokit.rest.actions.deleteActionsCacheById({
owner: owner,
repo: repo,
cache_id: id
});
if (response.status === 204) {
core.info(`Succesfully deleted cache with key: ${key}, id: ${id}`);
return 204;
}
}
}
catch (e) {
if (e instanceof request_error_1.RequestError) {
let err = e;
let errData = (_a = err.response) === null || _a === void 0 ? void 0 : _a.data;
exports.logWarning(`Github API reported error: ${err.name} '${err.status}: ${errData === null || errData === void 0 ? void 0 : errData.message}'`);
const err = e;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const errMessage = ((_a = err.response) === null || _a === void 0 ? void 0 : _a.data).message;
exports.logWarning(`Github API reported error: ${err.name} '${err.status}: ${errMessage}'`);
}
core.info(`Couldn't delete cache entry for key ${key}.`);
return;

View file

@ -7,9 +7,9 @@
"scripts": {
"build": "tsc && ncc build -o dist/restore src/restore.ts && ncc build -o dist/save src/save.ts && ncc build -o dist/restore-only src/restoreOnly.ts && ncc build -o dist/save-only src/saveOnly.ts",
"test": "tsc --noEmit && jest --coverage",
"lint": "eslint **/*.ts --cache",
"format": "prettier --write **/*.ts",
"format-check": "prettier --check **/*.ts"
"lint": "eslint src/**/*.ts --cache __tests__/*.ts --cache",
"format": "prettier --write **/**/*.ts",
"format-check": "prettier --check **/**/*.ts"
},
"repository": {
"type": "git",

View file

@ -1,10 +1,9 @@
import * as cache from "@actions/cache";
import * as core from "@actions/core";
import { RequestError } from "@octokit/request-error"
import { OctokitResponse } from "@octokit/types"
import { Octokit } from "@octokit/action";
import { RequestError } from "@octokit/request-error";
import { RefKey } from "../constants";
const { Octokit } = require("@octokit/action");
export function isGhes(): boolean {
const ghUrl = new URL(
@ -33,54 +32,69 @@ export function logWarning(message: string): void {
core.info(`${warningPrefix}${message}`);
}
export async function deleteCacheByKey(key: string, owner: string, repo: string) : Promise <number | void> {
export async function deleteCacheByKey(
key: string,
owner: string,
repo: string
): Promise<number | void> {
const octokit = new Octokit();
let response;
try {
const gitRef = process.env[RefKey];
let cacheEntry = await octokit.rest.actions.getActionsCacheList({
const cacheEntry = await octokit.rest.actions.getActionsCacheList({
owner: owner,
repo: repo,
key: key,
ref: gitRef
});
const { data: {
total_count,
actions_caches
}
});
const {
data: { total_count, actions_caches }
} = cacheEntry;
if (total_count !== 1 || total_count !== actions_caches.length) { // leave all find logic to the actual cache implementation. We just want to make sure we're returned a single element so we don't accidentally delete an entry that belongs to a different gitref.
if (total_count !== 1 || total_count !== actions_caches.length) {
// leave all find logic to the actual cache implementation. We just want to make sure we're returned a single element so we don't accidentally delete an entry that belongs to a different gitref.
if (total_count > 1) {
exports.logWarning(`More than one cache entry found for key ${key}`);
}
else if (total_count === 0 || actions_caches.length === 0) {
exports.logWarning(`No cache entries for key ${key} belong to gitref ${gitRef}.`);
exports.logWarning(
`More than one cache entry found for key ${key}`
);
} else if (total_count === 0 || actions_caches.length === 0) {
exports.logWarning(
`No cache entries for key ${key} belong to gitref ${gitRef}.`
);
}
// This situation is likely never actually going to come up.
// Istanbul is being dumb and I can't ignore this path.
else if (total_count !== actions_caches.length) {
exports.logWarning(`Reported cache entry matches for ${key} does not match length of 'actions_caches' array in API response.`);
exports.logWarning(
`Reported cache entry matches for ${key} does not match length of 'actions_caches' array in API response.`
);
}
core.info(`Skip trying to delete cache entry for key ${key}.`)
core.info(`Skip trying to delete cache entry for key ${key}.`);
return;
}
let id = actions_caches[0].id;
response = await octokit.rest.actions.deleteActionsCacheById({
owner: owner,
repo: repo,
cache_id: id
const id = actions_caches[0].id;
if (id) {
response = await octokit.rest.actions.deleteActionsCacheById({
owner: owner,
repo: repo,
cache_id: id
});
if (response.status === 204) {
core.info(`Succesfully deleted cache with key: ${key}, id: ${id}`);
return 204;
if (response.status === 204) {
core.info(
`Succesfully deleted cache with key: ${key}, id: ${id}`
);
return 204;
}
}
} catch (e) {
if (e instanceof RequestError) {
let err = e as RequestError;
let errData = err.response?.data as any | undefined;
exports.logWarning(`Github API reported error: ${err.name} '${err.status}: ${errData?.message}'`);
const err = e as RequestError;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const errMessage = (err.response?.data as any).message;
exports.logWarning(
`Github API reported error: ${err.name} '${err.status}: ${errMessage}'`
);
}
core.info(`Couldn't delete cache entry for key ${key}.`)
core.info(`Couldn't delete cache entry for key ${key}.`);
return;
}
}

View file

@ -1,14 +1,18 @@
/* istanbul ignore file */
import { Inputs } from "../constants";
import { rest } from "msw";
import { setupServer } from "msw/node";
import nock from "nock";
export const successCacheKey = "Linux-node-bb828da54c148048dd17899ba9fda624811cfb43";
export const wrongRefCacheKey = "Linux-latest-node-bb828da54c148048dd17899ba9fda624811cfb43";
export const failureCacheKey = "Windows-node-bb828da54c148048dd17899ba9fda624811cfb43";
export const passThroughCacheKey = "macOS-node-bb828da54c148048dd17899ba9fda624811cfb43";
import { Inputs } from "../constants";
export const successCacheKey =
"Linux-node-bb828da54c148048dd17899ba9fda624811cfb43";
export const wrongRefCacheKey =
"Linux-latest-node-bb828da54c148048dd17899ba9fda624811cfb43";
export const failureCacheKey =
"Windows-node-bb828da54c148048dd17899ba9fda624811cfb43";
export const passThroughCacheKey =
"macOS-node-bb828da54c148048dd17899ba9fda624811cfb43";
const successCacheId = 1337;
const failureCacheId = 69;
@ -61,79 +65,109 @@ export function clearInputs(): void {
}
export const mockServer = setupServer(
rest.delete('https://api.github.com/repos/owner/repo/actions/caches/', (req, res, ctx) => {
return res(ctx.status(422),
ctx.json({
message: "Invalid request.\n\nMissing required query parameter key",
documentation_url: "https://docs.github.com/rest/actions/cache#delete-github-actions-caches-for-a-repository-using-a-cache-key",
})
)
}),
rest.delete('https://api.github.com/repos/owner/repo/actions/caches/:id', (req, res, ctx) => {
const { id } = req.params;
if (parseInt(id as string) === failureCacheId) {
return res(ctx.status(404),
rest.delete(
"https://api.github.com/repos/owner/repo/actions/caches/",
(req, res, ctx) => {
return res(
ctx.status(422),
ctx.json({
message: "Not Found",
documentation_url: "https://docs.github.com/rest/actions/cache#delete-a-github-actions-cache-for-a-repository-using-a-cache-id"
}));
message:
"Invalid request.\n\nMissing required query parameter key",
documentation_url:
"https://docs.github.com/rest/actions/cache#delete-github-actions-caches-for-a-repository-using-a-cache-key"
})
);
}
return res(ctx.status(204));
}),
),
rest.delete(
"https://api.github.com/repos/owner/repo/actions/caches/:id",
(req, res, ctx) => {
const { id } = req.params;
if (parseInt(id as string) === failureCacheId) {
return res(
ctx.status(404),
ctx.json({
message: "Not Found",
documentation_url:
"https://docs.github.com/rest/actions/cache#delete-a-github-actions-cache-for-a-repository-using-a-cache-id"
})
);
}
return res(ctx.status(204));
}
),
// This endpoint always returns 200/OK, what we're checking here is whether we can get a unique cache ID, to avoid deleting the wrong entry.
rest.get('https://api.github.com/repos/owner/repo/actions/caches', (req, res, ctx) => {
let key : string = req.url?.searchParams?.get('key') || '';
let ref : string = req.url?.searchParams?.get('ref') || '';
if (key === '' || ref === '') {
return res(ctx.status(200),
ctx.json({
total_count: 2,
actions_caches: [{
id: 15,
ref: "refs/heads/main",
key: failureCacheKey,
version: "73885106f58cc52a7df9ec4d4a5622a5614813162cb516c759a30af6bf56e6f0",
last_accessed_at: "2022-12-29T22:06:42.683333300Z",
created_at: "2022-12-29T22:06:42.683333300Z",
size_in_bytes: 6057793
},
{
id: 16,
ref: "refs/heads/another-feature-branch",
key: failureCacheKey,
version: "73885106f58cc52a7df9ec4d4a5622a5614813162cb516c759a30af6bf56e6f0",
last_accessed_at: "2022-12-29T22:06:42.683333300Z",
created_at: "2022-12-29T22:06:42.683333300Z",
size_in_bytes: 6057793
}]
})
);
rest.get(
"https://api.github.com/repos/owner/repo/actions/caches",
(req, res, ctx) => {
const key: string = req.url?.searchParams?.get("key") || "";
const ref: string = req.url?.searchParams?.get("ref") || "";
if (key === "" || ref === "") {
return res(
ctx.status(200),
ctx.json({
total_count: 2,
actions_caches: [
{
id: 15,
ref: "refs/heads/main",
key: failureCacheKey,
version:
"73885106f58cc52a7df9ec4d4a5622a5614813162cb516c759a30af6bf56e6f0",
last_accessed_at:
"2022-12-29T22:06:42.683333300Z",
created_at: "2022-12-29T22:06:42.683333300Z",
size_in_bytes: 6057793
},
{
id: 16,
ref: "refs/heads/another-feature-branch",
key: failureCacheKey,
version:
"73885106f58cc52a7df9ec4d4a5622a5614813162cb516c759a30af6bf56e6f0",
last_accessed_at:
"2022-12-29T22:06:42.683333300Z",
created_at: "2022-12-29T22:06:42.683333300Z",
size_in_bytes: 6057793
}
]
})
);
}
// This is the behavior seen when search doesn't find anything, but it is seen both when no key matches, as well as when the key matches but the entry belongs to another (likely the base) branch.
else if (key === wrongRefCacheKey) {
return res(
ctx.status(200),
ctx.json({
total_count: 0,
actions_caches: []
})
);
} else if (key === successCacheKey || key === failureCacheKey) {
return res(
ctx.status(200),
ctx.json({
total_count: 1,
actions_caches: [
{
id:
key === successCacheKey
? successCacheId
: failureCacheId,
ref: ref,
key: key,
version:
"93a0f912fdb70083e929c1bf564bca2050be1c4e0932f7f9e78465ddcfbcc8f6",
last_accessed_at:
"2022-12-29T22:06:42.683333300Z",
created_at: "2022-12-29T22:06:42.683333300Z",
size_in_bytes: 6057793
}
]
})
);
}
return req.passthrough();
}
// This is the behavior seen when search doesn't find anything, but it is seen both when no key matches, as well as when the key matches but the entry belongs to another (likely the base) branch.
else if (key === wrongRefCacheKey) {
return res(ctx.status(200),
ctx.json({
total_count: 0,
actions_caches: []
})
);
}
else if (key === successCacheKey || key === failureCacheKey) {
return res(ctx.status(200),
ctx.json({
total_count: 1,
actions_caches: [{
id: (key === successCacheKey ? successCacheId : failureCacheId),
ref: ref,
key: key,
version: "93a0f912fdb70083e929c1bf564bca2050be1c4e0932f7f9e78465ddcfbcc8f6",
last_accessed_at: "2022-12-29T22:06:42.683333300Z",
created_at: "2022-12-29T22:06:42.683333300Z",
size_in_bytes: 6057793
}]
})
);
}
return req.passthrough();
})
);
)
);