From 79c70b753f0aac6271bf5f8b7a2e9223b09b5767 Mon Sep 17 00:00:00 2001 From: Gitea Actions Date: Thu, 1 May 2025 09:27:22 +0000 Subject: [PATCH] Deploy version 1.0.2 --- dist/index.js | 61 +++++++++++++++++++++++++++------------------------ 1 file changed, 32 insertions(+), 29 deletions(-) diff --git a/dist/index.js b/dist/index.js index 4e7c1a3..da10e0d 100644 --- a/dist/index.js +++ b/dist/index.js @@ -19741,10 +19741,10 @@ Support boolean input list: \`true | True | TRUE | false | False | FALSE\``); (0, command_1.issueCommand)("error", (0, utils_1.toCommandProperties)(properties), message instanceof Error ? message.toString() : message); } exports2.error = error; - function warning2(message, properties = {}) { + function warning3(message, properties = {}) { (0, command_1.issueCommand)("warning", (0, utils_1.toCommandProperties)(properties), message instanceof Error ? message.toString() : message); } - exports2.warning = warning2; + exports2.warning = warning3; function notice(message, properties = {}) { (0, command_1.issueCommand)("notice", (0, utils_1.toCommandProperties)(properties), message instanceof Error ? message.toString() : message); } @@ -24870,31 +24870,34 @@ var init_multipart_parser = __esm({ }); // src/index.ts -var core3 = __toESM(require_core()); +var core4 = __toESM(require_core()); // src/save.ts -var core = __toESM(require_core()); +var core2 = __toESM(require_core()); var fs4 = __toESM(require("fs")); // src/env.ts +var core = __toESM(require_core()); function getServerUrl() { const url = process.env.CACHE_SERVER_URL || "http://cache:8080"; if (!url) { - throw new Error("CACHE_SERVER_URL is not set"); + core.warning("CACHE_SERVER_URL is not set \u2013 using default URL."); } return url; } function getToken() { const token = process.env.ACTIONS_RUNTIME_TOKEN; if (!token) { - throw new Error("ACTIONS_RUNTIME_TOKEN is not set"); + core.warning("ACTIONS_RUNTIME_TOKEN is not set \u2013 skipping action."); + process.exit(0); } return token; } function getRepoInfo() { const repository = process.env.GITHUB_REPOSITORY; if (!repository) { - throw new Error("GITHUB_REPOSITORY is not set"); + core.warning("GITHUB_REPOSITORY is not set \u2013 skipping action."); + process.exit(0); } const [owner, repo] = repository.split("/"); return { owner, repo }; @@ -26351,7 +26354,7 @@ async function extractCompressedTar(archivePath, extractTo = "/") { // src/save.ts async function saveCache(key, paths, cmprss_lvl = 3) { - core.info(`\u{1F4BE} Starting cache save for key: ${key}`); + core2.info(`\u{1F4BE} Starting cache save for key: ${key}`); const startTime = Date.now(); const archivePath = await createCompressedTar(key, paths, cmprss_lvl); const archiveSize = fs4.statSync(archivePath).size; @@ -26365,17 +26368,17 @@ async function saveCache(key, paths, cmprss_lvl = 3) { ); const endTime = Date.now(); const duration = endTime - startTime; - core.info( + core2.info( `\u2705 Cache saved successfully (${formatSize(archiveSize)}, ${formatDuration(duration)}) ` ); } // src/restore.ts -var core2 = __toESM(require_core()); +var core3 = __toESM(require_core()); var fs5 = __toESM(require("fs")); async function restoreCache(key) { - core2.info(`\u{1F4E6} Starting cache restore for key: ${key}`); + core3.info(`\u{1F4E6} Starting cache restore for key: ${key}`); const startTime = Date.now(); const zstPath = `/tmp/${key}.tar.zst`; const { owner, repo } = getRepoInfo(); @@ -26387,14 +26390,14 @@ async function restoreCache(key) { zstPath ); if (!downloaded) { - core2.warning("\u26A0\uFE0F Cache archive not found, skipping restore."); + core3.warning("\u26A0\uFE0F Cache archive not found, skipping restore."); return false; } const archiveSize = fs5.statSync(zstPath).size; await extractCompressedTar(zstPath); const endTime = Date.now(); const duration = endTime - startTime; - core2.info( + core3.info( ` \u2705 Cache restored successfully (${formatSize(archiveSize)}, ${formatDuration(duration)}) ` @@ -26405,12 +26408,12 @@ async function restoreCache(key) { // src/index.ts async function run() { try { - if (core3.getState("isPost") === "true") { - core3.info("\n\u{1F9F9} Post-job: Saving cache..."); - const key = core3.getState("key"); - const paths = JSON.parse(core3.getState("paths") || "[]"); + if (core4.getState("isPost") === "true") { + core4.info("\n\u{1F9F9} Post-job: Saving cache..."); + const key = core4.getState("key"); + const paths = JSON.parse(core4.getState("paths") || "[]"); const compression_level = parseInt( - core3.getState("compression-level") || "3", + core4.getState("compression-level") || "3", 10 ); if (!key) { @@ -26421,30 +26424,30 @@ async function run() { } await saveCache(key, paths, compression_level); } else { - core3.info("\u{1F680} Pre-job: Restoring cache..."); - const key = core3.getInput("key", { required: true }); - const paths = core3.getMultilineInput("paths", { required: true }).filter( + core4.info("\u{1F680} Pre-job: Restoring cache..."); + const key = core4.getInput("key", { required: true }); + const paths = core4.getMultilineInput("paths", { required: true }).filter( (p) => p.trim() !== "" ); let compression_level = parseInt( - core3.getInput("compression-level", { required: false }) || "3", + core4.getInput("compression-level", { required: false }) || "3", 10 ); if (isNaN(compression_level) || compression_level < 0 || compression_level > 6) { compression_level = 3; } - core3.saveState("isPost", "true"); - core3.saveState("key", key); - core3.saveState("paths", JSON.stringify(paths)); - core3.saveState("compression-level", compression_level.toString()); + core4.saveState("isPost", "true"); + core4.saveState("key", key); + core4.saveState("paths", JSON.stringify(paths)); + core4.saveState("compression-level", compression_level.toString()); const restored = await restoreCache(key); - core3.setOutput("cache-hit", restored ? "true" : "false"); + core4.setOutput("cache-hit", restored ? "true" : "false"); } } catch (error) { if (error instanceof Error) { - core3.setFailed(error.message); + core4.setFailed(error.message); } else { - core3.setFailed(String(error)); + core4.setFailed(String(error)); } } }