Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8f842c2

Browse files
authored
Support Cargo.lock format cargo-lock v4 (Swatinem#211)
Fixed Swatinem#209 Signed-off-by: Jiahao XU <[email protected]>
1 parent 96a8d65 commit 8f842c2

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

dist/restore/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88363,7 +88363,7 @@ class CacheConfig {
8836388363
try {
8836488364
const content = await promises_default().readFile(cargo_lock, { encoding: "utf8" });
8836588365
const parsed = parse(content);
88366-
if (parsed.version !== 3 || !("package" in parsed)) {
88366+
if ((parsed.version !== 3 && parsed.version !== 4) || !("package" in parsed)) {
8836788367
// Fallback to caching them as regular file since this action
8836888368
// can only handle Cargo.lock format version 3
8836988369
lib_core.warning('Unsupported Cargo.lock format, fallback to caching entire file');

dist/save/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88363,7 +88363,7 @@ class CacheConfig {
8836388363
try {
8836488364
const content = await promises_default().readFile(cargo_lock, { encoding: "utf8" });
8836588365
const parsed = parse(content);
88366-
if (parsed.version !== 3 || !("package" in parsed)) {
88366+
if ((parsed.version !== 3 && parsed.version !== 4) || !("package" in parsed)) {
8836788367
// Fallback to caching them as regular file since this action
8836888368
// can only handle Cargo.lock format version 3
8836988369
core.warning('Unsupported Cargo.lock format, fallback to caching entire file');

src/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ export class CacheConfig {
197197
const content = await fs_promises.readFile(cargo_lock, { encoding: "utf8" });
198198
const parsed = toml.parse(content);
199199

200-
if (parsed.version !== 3 || !("package" in parsed)) {
200+
if ((parsed.version !== 3 && parsed.version !== 4) || !("package" in parsed)) {
201201
// Fallback to caching them as regular file since this action
202202
// can only handle Cargo.lock format version 3
203203
core.warning('Unsupported Cargo.lock format, fallback to caching entire file');

0 commit comments

Comments
 (0)