3
0
Fork 0
mirror of https://github.com/Swatinem/rust-cache synced 2026-03-04 07:40:24 +00:00

cause save state if no incrementa.json

This commit is contained in:
Jonathan Kelley 2025-01-28 19:22:56 -08:00
parent 0381560ff9
commit 36c8b73442
No known key found for this signature in database
GPG key ID: 1FBB50F7EB0A08BE
5 changed files with 229 additions and 119 deletions

View file

@ -7,11 +7,15 @@ import path from "path";
import { exists } from "./utils";
// import { Packages } from "./workspace";
let incremental_missing = false;
export function isIncrementalMissing(): boolean {
return incremental_missing;
}
export async function restoreIncremental(targetDir: string) {
core.debug(`restoring incremental directory "${targetDir}"`);
let dir = await fs.promises.opendir(targetDir);
for await (const dirent of dir) {
if (dirent.isDirectory()) {
@ -46,5 +50,8 @@ async function restoreIncrementalProfile(dirName: string) {
const filePath = path.join(dirName, fileName);
await fs.promises.utimes(filePath, new Date(mtime), new Date(mtime));
}
} else {
core.debug(`incremental-restore.json not found for ${dirName}`);
incremental_missing = true;
}
}