3
0
Fork 0
mirror of https://github.com/Swatinem/rust-cache synced 2025-11-05 06:59:13 +00:00

Add useJobKey option for cache naming

Add option to include GITHUB_JOB in cache key.
This commit is contained in:
Ryan Brice 2025-10-13 13:03:20 +08:00 committed by GitHub
parent 51dda28b91
commit f68c22f6e1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -24,6 +24,8 @@ export class CacheConfig {
public cacheKey = ""; public cacheKey = "";
/** The secondary (restore) key that only contains the prefix and environment */ /** The secondary (restore) key that only contains the prefix and environment */
public restoreKey = ""; public restoreKey = "";
/** If the 'GITHIB_JOB' environemnt variable should be added to the cache name */
public useJobKey = true;
/** Whether to cache CARGO_HOME/.bin */ /** Whether to cache CARGO_HOME/.bin */
public cacheBin: boolean = true; public cacheBin: boolean = true;
@ -69,7 +71,7 @@ export class CacheConfig {
} }
const job = process.env.GITHUB_JOB; const job = process.env.GITHUB_JOB;
if (job) { if ((job) && core.useJobKey == true) {
key += `-${job}`; key += `-${job}`;
} }
} }