mirror of
https://gitea.com/actions/stale.git
synced 2026-12-03 06:48:51 +00:00
Don not try to delete cache if it does not exists
This commit is contained in:
1 parent
cab99b362b
commit
8986f6218b
2 files changed
+14
-4
No files matched your search
Vendored
+5
-2
@@ -1636,7 +1636,7 @@ const resetCacheWithOctokit = (cacheKey) => __awaiter(void 0, void 0, void 0, fu
|
||||
}
|
||||
catch (error) {
|
||||
if (error.status) {
|
||||
core.debug(`Cache ${cacheKey} does not exist`);
|
||||
core.warning(`Error delete ${cacheKey}: [${error.status}] ${error.message || 'Unknown reason'}`);
|
||||
}
|
||||
else {
|
||||
throw error;
|
||||
@@ -1650,7 +1650,10 @@ class StateCacheStorage {
|
||||
const filePath = path_1.default.join(tmpDir, STATE_FILE);
|
||||
fs_1.default.writeFileSync(filePath, serializedState);
|
||||
try {
|
||||
yield resetCacheWithOctokit(CACHE_KEY);
|
||||
const cacheExists = yield checkIfCacheExists(CACHE_KEY);
|
||||
if (cacheExists) {
|
||||
yield resetCacheWithOctokit(CACHE_KEY);
|
||||
}
|
||||
const fileSize = fs_1.default.statSync(filePath).size;
|
||||
if (fileSize === 0) {
|
||||
core.info(`the state will be removed`);
|
||||
|
||||
Reference in new issue
Block a user