Fix workflow

This commit is contained in:
Ashcon Partovi
2024-04-22 17:55:03 -07:00
parent 0f57de0897
commit 4c124e58ea
6 changed files with 54 additions and 56 deletions

View File

@@ -74,7 +74,8 @@ export async function saveCache() {
if (isGithubHosted()) {
console.log("Using GitHub cache...");
try {
return await saveGithubCache([path], key);
const cacheId = await saveGithubCache([path], key);
return !!cacheId;
} catch (error) {
console.error("Failed to save cache:", error);
return false;

View File

@@ -69689,7 +69689,8 @@ async function saveCache() {
if (isGithubHosted()) {
console.log("Using GitHub cache...");
try {
return await cache.saveCache([path], key);
const cacheId = await cache.saveCache([path], key);
return !!cacheId;
} catch (error) {
console.error("Failed to save cache:", error);
return false;

View File

@@ -69689,7 +69689,8 @@ async function saveCache() {
if (isGithubHosted()) {
console.log("Using GitHub cache...");
try {
return await cache.saveCache([path], key);
const cacheId = await cache.saveCache([path], key);
return !!cacheId;
} catch (error) {
console.error("Failed to save cache:", error);
return false;
@@ -69733,21 +69734,19 @@ var cacheDir = core.getInput("cache-dir") || join(tmpdir(), ".github", "cache");
// restore/action.mjs
var core2 = __toESM(require_core(), 1);
async function main() {
try {
const result = await restoreCache();
if (result) {
const { cacheHit, cacheKey } = result;
console.log("Cache key:", cacheKey, cacheHit ? "(hit)" : "(miss)");
core2.setOutput("cache-hit", cacheHit);
core2.setOutput("cache-matched-key", cacheKey);
if (cacheHit) {
core2.setOutput("cache-primary-key", cacheKey);
}
return;
}
} catch (error) {
console.error("Failed to restore cache:", error);
const result = await restoreCache();
if (!result) {
process.exit(1);
}
const { cacheHit, cacheKey } = result;
console.log("Cache key:", cacheKey, cacheHit ? "(hit)" : "(miss)");
core2.setOutput("cache-hit", cacheHit);
core2.setOutput("cache-matched-key", cacheKey);
if (cacheHit) {
core2.setOutput("cache-primary-key", cacheKey);
}
process.exit(1);
}
main();
main().catch((error) => {
console.error("Failed to restore cache:", error);
process.exit(1);
});

View File

@@ -69689,7 +69689,8 @@ async function saveCache() {
if (isGithubHosted()) {
console.log("Using GitHub cache...");
try {
return await cache.saveCache([path], key);
const cacheId = await cache.saveCache([path], key);
return !!cacheId;
} catch (error) {
console.error("Failed to save cache:", error);
return false;
@@ -69732,15 +69733,14 @@ var cacheDir = core.getInput("cache-dir") || join(tmpdir(), ".github", "cache");
// save/action.mjs
async function main() {
try {
const ok = await saveCache();
if (ok) {
console.log("Cache saved");
return;
}
} catch (error) {
console.error("Failed to restore cache:", error);
const saved = await saveCache();
if (saved) {
console.log("Cache saved");
} else {
process.exit(1);
}
process.exit(1);
}
main();
main().catch((error) => {
console.error("Failed to save cache:", error);
process.exit(1);
});

View File

@@ -2,22 +2,20 @@ import { setOutput } from "@actions/core";
import { restoreCache } from "../action.mjs";
async function main() {
try {
const result = await restoreCache();
if (result) {
const { cacheHit, cacheKey } = result;
console.log("Cache key:", cacheKey, cacheHit ? "(hit)" : "(miss)");
setOutput("cache-hit", cacheHit);
setOutput("cache-matched-key", cacheKey);
if (cacheHit) {
setOutput("cache-primary-key", cacheKey);
}
return;
}
} catch (error) {
console.error("Failed to restore cache:", error);
const result = await restoreCache();
if (!result) {
process.exit(1);
}
const { cacheHit, cacheKey } = result;
console.log("Cache key:", cacheKey, cacheHit ? "(hit)" : "(miss)");
setOutput("cache-hit", cacheHit);
setOutput("cache-matched-key", cacheKey);
if (cacheHit) {
setOutput("cache-primary-key", cacheKey);
}
process.exit(1);
}
main();
main().catch(error => {
console.error("Failed to restore cache:", error);
process.exit(1);
});

View File

@@ -1,16 +1,15 @@
import { saveCache } from "../action.mjs";
async function main() {
try {
const ok = await saveCache();
if (ok) {
console.log("Cache saved");
return;
}
} catch (error) {
console.error("Failed to restore cache:", error);
const saved = await saveCache();
if (saved) {
console.log("Cache saved");
} else {
process.exit(1);
}
process.exit(1);
}
main();
main().catch(error => {
console.error("Failed to save cache:", error);
process.exit(1);
});