From df5298f6e004f311a59b6c2e4bc3e7d0bac2f5e9 Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Sat, 5 Nov 2022 16:19:47 -0300 Subject: [PATCH] also search for rust-toolchain files on each workspace --- src/config.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/config.ts b/src/config.ts index 8c6dc4f..a6b45c3 100644 --- a/src/config.ts +++ b/src/config.ts @@ -36,7 +36,7 @@ export class CacheConfig { /** The files considered for the cache key */ private keyFiles: Array = []; - private constructor() { } + private constructor() {} /** * Constructs a [`CacheConfig`] with all the paths and keys. @@ -116,6 +116,7 @@ export class CacheConfig { // might create/overwrite lockfiles. let lockHash = core.getState(STATE_LOCKFILE_HASH); + let keyFiles: Array = JSON.parse(core.getState(STATE_LOCKFILES) || "[]"); // Constructs the workspace config and paths to restore: // The workspaces are given using a `$workspace -> $target` syntax. @@ -130,8 +131,6 @@ export class CacheConfig { } self.workspaces = workspaces; - let keyFiles: Array = JSON.parse(core.getState(STATE_LOCKFILES) || "[]"); - if (!lockHash) { hasher = crypto.createHash("sha1"); @@ -145,7 +144,7 @@ export class CacheConfig { keyFiles = keyFiles.concat(await globHash("rust-toolchain\nrust-toolchain.toml")); for (const workspace of workspaces) { const root = workspace.root; - keyFiles = keyFiles.concat(await globHash(`${root}/**/Cargo.toml\n${root}/**/Cargo.lock`)); + keyFiles = keyFiles.concat(await globHash(`${root}/**/Cargo.toml\n${root}/**/Cargo.lock\n${root}/**/rust-toolchain\n${root}/**/rust-toolchain.toml`)); } keyFiles.sort((a, b) => a.localeCompare(b));