mirror of
https://github.com/Swatinem/rust-cache
synced 2025-11-05 15:06:02 +00:00
feat: Update cache key configuration option names for better clarity for their intended functionality
This commit is contained in:
parent
c21ebd7031
commit
70fec6c203
3 changed files with 15 additions and 13 deletions
10
README.md
10
README.md
|
|
@ -28,13 +28,15 @@ sensible defaults.
|
||||||
# default: empty
|
# default: empty
|
||||||
key: ""
|
key: ""
|
||||||
|
|
||||||
# If the automatic `job`-based cache key should be used for the cache name.
|
# If the automatic `job`-based cache key should include the job id.
|
||||||
# default: "true"
|
# default: "true"
|
||||||
use-job-key: ""
|
add-job-id-key: ""
|
||||||
|
|
||||||
# If the automatic `job`-based cache key should include a hash of the job's contents.
|
# Weather the a hash of the rust environment should be included in the cache key.
|
||||||
|
# This includes a hash of all Cargo.toml/Cargo.lock files, rust-toolchain files,
|
||||||
|
# and .cargo/config.toml files (if present), as well as the specified 'env-vars'.
|
||||||
# default: "true"
|
# default: "true"
|
||||||
add-job-hash: ""
|
add-rust-environment-hash-key: ""
|
||||||
|
|
||||||
# A whitespace separated list of env-var *prefixes* who's value contributes
|
# A whitespace separated list of env-var *prefixes* who's value contributes
|
||||||
# to the environment cache key.
|
# to the environment cache key.
|
||||||
|
|
|
||||||
|
|
@ -12,12 +12,12 @@ inputs:
|
||||||
key:
|
key:
|
||||||
description: "An additional cache key that is added alongside the automatic `job`-based cache key and can be used to further differentiate jobs."
|
description: "An additional cache key that is added alongside the automatic `job`-based cache key and can be used to further differentiate jobs."
|
||||||
required: false
|
required: false
|
||||||
use-job-key:
|
add-job-id-key:
|
||||||
description: "If the automatic `job`-based cache key should be used for the cache name. Defaults to true."
|
description: "If the automatic `job`-based cache key should include the job id. Defaults to true."
|
||||||
required: false
|
required: false
|
||||||
default: "true"
|
default: "true"
|
||||||
add-job-hash:
|
add-rust-environment-hash-key:
|
||||||
description: "If the automatic `job`-based cache key should include a hash of the job's contents. Defaults to false."
|
description: "Weather the a hash of the rust environment should be included in the cache key. This includes a hash of all Cargo.toml/Cargo.lock files, rust-toolchain files, and .cargo/config.toml files (if present), as well as the specified 'env-vars'. Defaults to true."
|
||||||
required: false
|
required: false
|
||||||
default: "true"
|
default: "true"
|
||||||
env-vars:
|
env-vars:
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ export class CacheConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
const job = process.env.GITHUB_JOB;
|
const job = process.env.GITHUB_JOB;
|
||||||
if ((job) && core.getInput("use-job-key").toLowerCase() == "true") {
|
if ((job) && core.getInput("add-job-id-key").toLowerCase() == "true") {
|
||||||
key += `-${job}`;
|
key += `-${job}`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -116,8 +116,8 @@ export class CacheConfig {
|
||||||
|
|
||||||
self.keyEnvs = keyEnvs;
|
self.keyEnvs = keyEnvs;
|
||||||
|
|
||||||
// Add job hash suffix if 'add-job-hash' is true
|
// Add job hash suffix if 'add-rust-environment-hash-key' is true
|
||||||
if (core.getInput("add-job-hash").toLowerCase() == "true") {
|
if (core.getInput("add-rust-environment-hash-key").toLowerCase() == "true") {
|
||||||
key += `-${digest(hasher)}`;
|
key += `-${digest(hasher)}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -244,8 +244,8 @@ export class CacheConfig {
|
||||||
keyFiles.push(...parsedKeyFiles);
|
keyFiles.push(...parsedKeyFiles);
|
||||||
self.keyFiles = sort_and_uniq(keyFiles);
|
self.keyFiles = sort_and_uniq(keyFiles);
|
||||||
|
|
||||||
// Add lock hash suffix if 'add-job-hash' is true
|
// Add lock hash suffix if 'add-rust-environment-hash-key' is true
|
||||||
if (core.getInput("add-job-hash").toLowerCase() == "true") {
|
if (core.getInput("add-rust-environment-hash-key").toLowerCase() == "true") {
|
||||||
let lockHash = digest(hasher);
|
let lockHash = digest(hasher);
|
||||||
key += `-${lockHash}`;
|
key += `-${lockHash}`;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue