mirror of
https://github.com/Swatinem/rust-cache
synced 2025-11-05 15:06:02 +00:00
fix: Move 'if' check for 'add-rust-environment-hash-key' input above keyFiles definition to avoid un-needed computation
This commit is contained in:
parent
967280621f
commit
6424dd79ce
3 changed files with 233 additions and 230 deletions
5
dist/restore/index.js
vendored
5
dist/restore/index.js
vendored
|
|
@ -148844,6 +148844,9 @@ class CacheConfig {
|
|||
workspaces.push(new Workspace(root, target));
|
||||
}
|
||||
self.workspaces = workspaces;
|
||||
// Add hash suffix of all rust environment lockfiles + manifests if
|
||||
// 'add-rust-environment-hash-key' is true
|
||||
if (lib_core.getInput("add-rust-environment-hash-key").toLowerCase() == "true") {
|
||||
let keyFiles = await globFiles(".cargo/config.toml\nrust-toolchain\nrust-toolchain.toml");
|
||||
const parsedKeyFiles = []; // keyFiles that are parsed, pre-processed and hashed
|
||||
hasher = external_crypto_default().createHash("sha1");
|
||||
|
|
@ -148926,8 +148929,6 @@ class CacheConfig {
|
|||
}
|
||||
keyFiles.push(...parsedKeyFiles);
|
||||
self.keyFiles = sort_and_uniq(keyFiles);
|
||||
// Add lock hash suffix if 'add-rust-environment-hash-key' is true
|
||||
if (lib_core.getInput("add-rust-environment-hash-key").toLowerCase() == "true") {
|
||||
let lockHash = digest(hasher);
|
||||
key += `-${lockHash}`;
|
||||
}
|
||||
|
|
|
|||
5
dist/save/index.js
vendored
5
dist/save/index.js
vendored
|
|
@ -148844,6 +148844,9 @@ class CacheConfig {
|
|||
workspaces.push(new Workspace(root, target));
|
||||
}
|
||||
self.workspaces = workspaces;
|
||||
// Add hash suffix of all rust environment lockfiles + manifests if
|
||||
// 'add-rust-environment-hash-key' is true
|
||||
if (core.getInput("add-rust-environment-hash-key").toLowerCase() == "true") {
|
||||
let keyFiles = await globFiles(".cargo/config.toml\nrust-toolchain\nrust-toolchain.toml");
|
||||
const parsedKeyFiles = []; // keyFiles that are parsed, pre-processed and hashed
|
||||
hasher = external_crypto_default().createHash("sha1");
|
||||
|
|
@ -148926,8 +148929,6 @@ class CacheConfig {
|
|||
}
|
||||
keyFiles.push(...parsedKeyFiles);
|
||||
self.keyFiles = sort_and_uniq(keyFiles);
|
||||
// Add lock hash suffix if 'add-rust-environment-hash-key' is true
|
||||
if (core.getInput("add-rust-environment-hash-key").toLowerCase() == "true") {
|
||||
let lockHash = digest(hasher);
|
||||
key += `-${lockHash}`;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -142,6 +142,9 @@ export class CacheConfig {
|
|||
}
|
||||
self.workspaces = workspaces;
|
||||
|
||||
// Add hash suffix of all rust environment lockfiles + manifests if
|
||||
// 'add-rust-environment-hash-key' is true
|
||||
if (core.getInput("add-rust-environment-hash-key").toLowerCase() == "true") {
|
||||
let keyFiles = await globFiles(".cargo/config.toml\nrust-toolchain\nrust-toolchain.toml");
|
||||
const parsedKeyFiles = []; // keyFiles that are parsed, pre-processed and hashed
|
||||
|
||||
|
|
@ -244,8 +247,6 @@ export class CacheConfig {
|
|||
keyFiles.push(...parsedKeyFiles);
|
||||
self.keyFiles = sort_and_uniq(keyFiles);
|
||||
|
||||
// Add lock hash suffix if 'add-rust-environment-hash-key' is true
|
||||
if (core.getInput("add-rust-environment-hash-key").toLowerCase() == "true") {
|
||||
let lockHash = digest(hasher);
|
||||
key += `-${lockHash}`;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue