Deploy version 1.2.0
This commit is contained in:
12
dist/index.js
vendored
12
dist/index.js
vendored
@@ -26242,6 +26242,14 @@ function expandPath(p) {
|
|||||||
);
|
);
|
||||||
return import_path.default.resolve(p);
|
return import_path.default.resolve(p);
|
||||||
}
|
}
|
||||||
|
function sanitizeKey(key) {
|
||||||
|
key = key.trim();
|
||||||
|
key = key.replace(/[^a-zA-Z0-9._-]/g, "_");
|
||||||
|
if (key.length === 0) {
|
||||||
|
throw new Error("Cache key cannot be empty after sanitization.");
|
||||||
|
}
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
// src/cache.ts
|
// src/cache.ts
|
||||||
async function uploadCache(options, owner, repo, key, filePath) {
|
async function uploadCache(options, owner, repo, key, filePath) {
|
||||||
@@ -26317,7 +26325,7 @@ async function createCompressedTar(key, paths, cmprss_lvl = 3) {
|
|||||||
throw new Error("No paths specified for archiving.");
|
throw new Error("No paths specified for archiving.");
|
||||||
}
|
}
|
||||||
const tempDir = await fs3.promises.mkdtemp(path2.join(os2.tmpdir(), "cache-"));
|
const tempDir = await fs3.promises.mkdtemp(path2.join(os2.tmpdir(), "cache-"));
|
||||||
const archivePath = path2.join(tempDir, `${key}.tar.zst`);
|
const archivePath = path2.join(tempDir, `${sanitizeKey(key)}.tar.zst`);
|
||||||
const quotedPaths = paths.map((p) => `"${expandPath(p)}"`).join(" ");
|
const quotedPaths = paths.map((p) => `"${expandPath(p)}"`).join(" ");
|
||||||
const cmd = `tar -cf - ${quotedPaths} | zstd -${cmprss_lvl} -o "${archivePath}"`;
|
const cmd = `tar -cf - ${quotedPaths} | zstd -${cmprss_lvl} -o "${archivePath}"`;
|
||||||
console.log(`
|
console.log(`
|
||||||
@@ -26386,7 +26394,7 @@ var fs5 = __toESM(require("fs"));
|
|||||||
async function restoreCache(key) {
|
async function restoreCache(key) {
|
||||||
core3.info(`\u{1F4E6} Starting cache restore for key: ${key}`);
|
core3.info(`\u{1F4E6} Starting cache restore for key: ${key}`);
|
||||||
const startTime = Date.now();
|
const startTime = Date.now();
|
||||||
const zstPath = `/tmp/${key}.tar.zst`;
|
const zstPath = `/tmp/${sanitizeKey(key)}.tar.zst`;
|
||||||
const { owner, repo } = getRepoInfo();
|
const { owner, repo } = getRepoInfo();
|
||||||
const downloaded = await downloadCache(
|
const downloaded = await downloadCache(
|
||||||
{ serverUrl: getServerUrl(), token: getToken() },
|
{ serverUrl: getServerUrl(), token: getToken() },
|
||||||
|
Reference in New Issue
Block a user