mirror of
https://code.forgejo.org/actions/cache.git
synced 2024-11-16 23:51:16 +01:00
console res
This commit is contained in:
parent
a54eb92c7c
commit
fa608b2294
4 changed files with 39 additions and 33 deletions
33
dist/restore/index.js
vendored
33
dist/restore/index.js
vendored
|
@ -3278,9 +3278,11 @@ function reserveCache(key, paths, options) {
|
|||
version,
|
||||
cacheSize: options === null || options === void 0 ? void 0 : options.cacheSize
|
||||
};
|
||||
const response = yield requestUtils_1.retryTypedResponse('reserveCache', () => __awaiter(this, void 0, void 0, function* () {
|
||||
return httpClient.postJson(getCacheApiUrl('caches'), reserveCacheRequest);
|
||||
const response = yield requestUtils_1.retryHttpClientResponse('reserveCache', () => __awaiter(this, void 0, void 0, function* () {
|
||||
return httpClient.post(getCacheApiUrl('caches'), JSON.stringify(reserveCacheRequest));
|
||||
}));
|
||||
console.log("\n\nResponse\n\n");
|
||||
console.log(response);
|
||||
return response;
|
||||
});
|
||||
}
|
||||
|
@ -46426,7 +46428,6 @@ exports.restoreCache = restoreCache;
|
|||
* @returns number returns cacheId if the cache was saved successfully and throws an error if save fails
|
||||
*/
|
||||
function saveCache(paths, key, options) {
|
||||
var _a, _b;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
checkPaths(paths);
|
||||
checkKey(key);
|
||||
|
@ -46451,16 +46452,20 @@ function saveCache(paths, key, options) {
|
|||
compressionMethod,
|
||||
cacheSize
|
||||
});
|
||||
console.log(reserveCacheResponse);
|
||||
if ((reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.statusCode) === 400) {
|
||||
throw new ReserveCacheError(`Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the data cap limit, not saving cache.`);
|
||||
}
|
||||
if ((_a = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.result) === null || _a === void 0 ? void 0 : _a.cacheId) {
|
||||
cacheId = (_b = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.result) === null || _b === void 0 ? void 0 : _b.cacheId;
|
||||
}
|
||||
else {
|
||||
throw new ReserveCacheError(`Unable to reserve cache with key ${key}, another job may be creating this cache.`);
|
||||
}
|
||||
// if(reserveCacheResponse?.statusCode === 400 && reserveCacheResponse?.result?.typeKey === "InvalidReserveCacheRequestException"){
|
||||
// throw new ReserveCacheError(
|
||||
// reserveCacheResponse?.result?.message ??
|
||||
// `Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the data cap limit, not saving cache.`
|
||||
// )
|
||||
// }
|
||||
// if(reserveCacheResponse?.result?.cacheId){
|
||||
// cacheId = reserveCacheResponse?.result?.cacheId
|
||||
// }else{
|
||||
// throw new ReserveCacheError(
|
||||
// `Unable to reserve cache with key ${key}, another job may be creating this cache.`
|
||||
// )
|
||||
// }
|
||||
throw new ReserveCacheError(`Unable to reserve cache with key ${key}, another job may be creating this cache.`);
|
||||
core.debug(`Cache ID: ${cacheId}`);
|
||||
core.debug(`Saving Cache (ID: ${cacheId})`);
|
||||
yield cacheHttpClient.saveCache(cacheId, archivePath, options);
|
||||
|
@ -51558,8 +51563,6 @@ function retryTypedResponse(name, method, maxAttempts = constants_1.DefaultRetry
|
|||
// an ITypedResponse<T> so it can be processed by the retry logic.
|
||||
(error) => {
|
||||
if (error instanceof http_client_1.HttpClientError) {
|
||||
console.log("\n\nRESULT\n\n");
|
||||
console.log(error.result);
|
||||
return {
|
||||
statusCode: error.statusCode,
|
||||
result: null,
|
||||
|
|
33
dist/save/index.js
vendored
33
dist/save/index.js
vendored
|
@ -3278,9 +3278,11 @@ function reserveCache(key, paths, options) {
|
|||
version,
|
||||
cacheSize: options === null || options === void 0 ? void 0 : options.cacheSize
|
||||
};
|
||||
const response = yield requestUtils_1.retryTypedResponse('reserveCache', () => __awaiter(this, void 0, void 0, function* () {
|
||||
return httpClient.postJson(getCacheApiUrl('caches'), reserveCacheRequest);
|
||||
const response = yield requestUtils_1.retryHttpClientResponse('reserveCache', () => __awaiter(this, void 0, void 0, function* () {
|
||||
return httpClient.post(getCacheApiUrl('caches'), JSON.stringify(reserveCacheRequest));
|
||||
}));
|
||||
console.log("\n\nResponse\n\n");
|
||||
console.log(response);
|
||||
return response;
|
||||
});
|
||||
}
|
||||
|
@ -46520,7 +46522,6 @@ exports.restoreCache = restoreCache;
|
|||
* @returns number returns cacheId if the cache was saved successfully and throws an error if save fails
|
||||
*/
|
||||
function saveCache(paths, key, options) {
|
||||
var _a, _b;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
checkPaths(paths);
|
||||
checkKey(key);
|
||||
|
@ -46545,16 +46546,20 @@ function saveCache(paths, key, options) {
|
|||
compressionMethod,
|
||||
cacheSize
|
||||
});
|
||||
console.log(reserveCacheResponse);
|
||||
if ((reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.statusCode) === 400) {
|
||||
throw new ReserveCacheError(`Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the data cap limit, not saving cache.`);
|
||||
}
|
||||
if ((_a = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.result) === null || _a === void 0 ? void 0 : _a.cacheId) {
|
||||
cacheId = (_b = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.result) === null || _b === void 0 ? void 0 : _b.cacheId;
|
||||
}
|
||||
else {
|
||||
throw new ReserveCacheError(`Unable to reserve cache with key ${key}, another job may be creating this cache.`);
|
||||
}
|
||||
// if(reserveCacheResponse?.statusCode === 400 && reserveCacheResponse?.result?.typeKey === "InvalidReserveCacheRequestException"){
|
||||
// throw new ReserveCacheError(
|
||||
// reserveCacheResponse?.result?.message ??
|
||||
// `Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the data cap limit, not saving cache.`
|
||||
// )
|
||||
// }
|
||||
// if(reserveCacheResponse?.result?.cacheId){
|
||||
// cacheId = reserveCacheResponse?.result?.cacheId
|
||||
// }else{
|
||||
// throw new ReserveCacheError(
|
||||
// `Unable to reserve cache with key ${key}, another job may be creating this cache.`
|
||||
// )
|
||||
// }
|
||||
throw new ReserveCacheError(`Unable to reserve cache with key ${key}, another job may be creating this cache.`);
|
||||
core.debug(`Cache ID: ${cacheId}`);
|
||||
core.debug(`Saving Cache (ID: ${cacheId})`);
|
||||
yield cacheHttpClient.saveCache(cacheId, archivePath, options);
|
||||
|
@ -51561,8 +51566,6 @@ function retryTypedResponse(name, method, maxAttempts = constants_1.DefaultRetry
|
|||
// an ITypedResponse<T> so it can be processed by the retry logic.
|
||||
(error) => {
|
||||
if (error instanceof http_client_1.HttpClientError) {
|
||||
console.log("\n\nRESULT\n\n");
|
||||
console.log(error.result);
|
||||
return {
|
||||
statusCode: error.statusCode,
|
||||
result: null,
|
||||
|
|
4
package-lock.json
generated
4
package-lock.json
generated
|
@ -5,8 +5,8 @@
|
|||
"requires": true,
|
||||
"dependencies": {
|
||||
"@actions/cache": {
|
||||
"version": "file:actions-cache-2.4.0.tgz",
|
||||
"integrity": "sha512-AfWcypsHwZGDjm6J4nBVvhuggVpz9bkkn2qPCycowbInKTwMVZOTZFQS1CaxOjcoOdzbpzrUk0uCu426at5mbg==",
|
||||
"version": "file:actions-cache-2.5.0.tgz",
|
||||
"integrity": "sha512-Op00dHgPDvY4EJdde8NIAK4JZjzz3uao8ECVsgN1/KAp0SKtEXKPntS+hrNhTLMnZqBqI74+WZlRWqbpDlus/w==",
|
||||
"requires": {
|
||||
"@actions/core": "^1.2.6",
|
||||
"@actions/exec": "^1.0.1",
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
"author": "GitHub",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/cache": "file:actions-cache-2.4.0.tgz",
|
||||
"@actions/cache": "file:actions-cache-2.5.0.tgz",
|
||||
"@actions/core": "^1.2.6",
|
||||
"@actions/exec": "^1.1.1",
|
||||
"@actions/io": "^1.1.2"
|
||||
|
|
Loading…
Reference in a new issue