From 8f842c2d455cfe3d0d5a4b28f53f5389b51b71bf Mon Sep 17 00:00:00 2001 From: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> Date: Wed, 9 Oct 2024 05:55:46 +1100 Subject: [PATCH] Support Cargo.lock format cargo-lock v4 (#211) Fixed #209 Signed-off-by: Jiahao XU --- dist/restore/index.js | 2 +- dist/save/index.js | 2 +- src/config.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dist/restore/index.js b/dist/restore/index.js index ef32a83..aaa23a8 100644 --- a/dist/restore/index.js +++ b/dist/restore/index.js @@ -88363,7 +88363,7 @@ class CacheConfig { try { const content = await promises_default().readFile(cargo_lock, { encoding: "utf8" }); const parsed = parse(content); - if (parsed.version !== 3 || !("package" in parsed)) { + if ((parsed.version !== 3 && parsed.version !== 4) || !("package" in parsed)) { // Fallback to caching them as regular file since this action // can only handle Cargo.lock format version 3 lib_core.warning('Unsupported Cargo.lock format, fallback to caching entire file'); diff --git a/dist/save/index.js b/dist/save/index.js index f50bde9..046bfae 100644 --- a/dist/save/index.js +++ b/dist/save/index.js @@ -88363,7 +88363,7 @@ class CacheConfig { try { const content = await promises_default().readFile(cargo_lock, { encoding: "utf8" }); const parsed = parse(content); - if (parsed.version !== 3 || !("package" in parsed)) { + if ((parsed.version !== 3 && parsed.version !== 4) || !("package" in parsed)) { // Fallback to caching them as regular file since this action // can only handle Cargo.lock format version 3 core.warning('Unsupported Cargo.lock format, fallback to caching entire file'); diff --git a/src/config.ts b/src/config.ts index 2b24788..15ca1cf 100644 --- a/src/config.ts +++ b/src/config.ts @@ -197,7 +197,7 @@ export class CacheConfig { const content = await fs_promises.readFile(cargo_lock, { encoding: "utf8" }); const parsed = toml.parse(content); - if (parsed.version !== 3 || !("package" in parsed)) { + if ((parsed.version !== 3 && parsed.version !== 4) || !("package" in parsed)) { // Fallback to caching them as regular file since this action // can only handle Cargo.lock format version 3 core.warning('Unsupported Cargo.lock format, fallback to caching entire file');