mirror of
https://github.com/Swatinem/rust-cache
synced 2025-11-05 15:06:02 +00:00
feat: Add conditional lock hash suffix to cache key based on 'add-job-hash' input
This commit is contained in:
parent
371912eafa
commit
c21ebd7031
4 changed files with 17 additions and 7 deletions
7
dist/restore/index.js
vendored
7
dist/restore/index.js
vendored
|
|
@ -85595,10 +85595,13 @@ class CacheConfig {
|
||||||
hasher.update(chunk);
|
hasher.update(chunk);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let lockHash = digest(hasher);
|
|
||||||
keyFiles.push(...parsedKeyFiles);
|
keyFiles.push(...parsedKeyFiles);
|
||||||
self.keyFiles = sort_and_uniq(keyFiles);
|
self.keyFiles = sort_and_uniq(keyFiles);
|
||||||
key += `-${lockHash}`;
|
// Add lock hash suffix if 'add-job-hash' is true
|
||||||
|
if (core.getInput("add-job-hash").toLowerCase() == "true") {
|
||||||
|
let lockHash = digest(hasher);
|
||||||
|
key += `-${lockHash}`;
|
||||||
|
}
|
||||||
self.cacheKey = key;
|
self.cacheKey = key;
|
||||||
self.cachePaths = [path_1.default.join(exports.CARGO_HOME, "registry"), path_1.default.join(exports.CARGO_HOME, "git")];
|
self.cachePaths = [path_1.default.join(exports.CARGO_HOME, "registry"), path_1.default.join(exports.CARGO_HOME, "git")];
|
||||||
if (self.cacheBin) {
|
if (self.cacheBin) {
|
||||||
|
|
|
||||||
7
dist/save/index.js
vendored
7
dist/save/index.js
vendored
|
|
@ -85595,10 +85595,13 @@ class CacheConfig {
|
||||||
hasher.update(chunk);
|
hasher.update(chunk);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let lockHash = digest(hasher);
|
|
||||||
keyFiles.push(...parsedKeyFiles);
|
keyFiles.push(...parsedKeyFiles);
|
||||||
self.keyFiles = sort_and_uniq(keyFiles);
|
self.keyFiles = sort_and_uniq(keyFiles);
|
||||||
key += `-${lockHash}`;
|
// Add lock hash suffix if 'add-job-hash' is true
|
||||||
|
if (core.getInput("add-job-hash").toLowerCase() == "true") {
|
||||||
|
let lockHash = digest(hasher);
|
||||||
|
key += `-${lockHash}`;
|
||||||
|
}
|
||||||
self.cacheKey = key;
|
self.cacheKey = key;
|
||||||
self.cachePaths = [path_1.default.join(exports.CARGO_HOME, "registry"), path_1.default.join(exports.CARGO_HOME, "git")];
|
self.cachePaths = [path_1.default.join(exports.CARGO_HOME, "registry"), path_1.default.join(exports.CARGO_HOME, "git")];
|
||||||
if (self.cacheBin) {
|
if (self.cacheBin) {
|
||||||
|
|
|
||||||
1
package-lock.json
generated
1
package-lock.json
generated
|
|
@ -577,6 +577,7 @@
|
||||||
"version": "5.2.2",
|
"version": "5.2.2",
|
||||||
"resolved": "https://registry.npmjs.org/@octokit/core/-/core-5.2.2.tgz",
|
"resolved": "https://registry.npmjs.org/@octokit/core/-/core-5.2.2.tgz",
|
||||||
"integrity": "sha512-/g2d4sW9nUDJOMz3mabVQvOGhVa4e/BN/Um7yca9Bb2XTzPPnfTWHWQg+IsEYO7M3Vx+EXvaM/I2pJWIMun1bg==",
|
"integrity": "sha512-/g2d4sW9nUDJOMz3mabVQvOGhVa4e/BN/Um7yca9Bb2XTzPPnfTWHWQg+IsEYO7M3Vx+EXvaM/I2pJWIMun1bg==",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@octokit/auth-token": "^4.0.0",
|
"@octokit/auth-token": "^4.0.0",
|
||||||
"@octokit/graphql": "^7.1.0",
|
"@octokit/graphql": "^7.1.0",
|
||||||
|
|
|
||||||
|
|
@ -241,12 +241,15 @@ export class CacheConfig {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let lockHash = digest(hasher);
|
|
||||||
|
|
||||||
keyFiles.push(...parsedKeyFiles);
|
keyFiles.push(...parsedKeyFiles);
|
||||||
self.keyFiles = sort_and_uniq(keyFiles);
|
self.keyFiles = sort_and_uniq(keyFiles);
|
||||||
|
|
||||||
key += `-${lockHash}`;
|
// Add lock hash suffix if 'add-job-hash' is true
|
||||||
|
if (core.getInput("add-job-hash").toLowerCase() == "true") {
|
||||||
|
let lockHash = digest(hasher);
|
||||||
|
key += `-${lockHash}`;
|
||||||
|
}
|
||||||
|
|
||||||
self.cacheKey = key;
|
self.cacheKey = key;
|
||||||
|
|
||||||
self.cachePaths = [path.join(CARGO_HOME, "registry"), path.join(CARGO_HOME, "git")];
|
self.cachePaths = [path.join(CARGO_HOME, "registry"), path.join(CARGO_HOME, "git")];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue