From 70fec6c203458d6c55f1a4db76833b8f9415480f Mon Sep 17 00:00:00 2001 From: Ryan-Brice <182604967+Ryan-Brice@users.noreply.github.com> Date: Fri, 31 Oct 2025 16:07:47 +0800 Subject: [PATCH] feat: Update cache key configuration option names for better clarity for their intended functionality --- README.md | 10 ++++++---- action.yml | 8 ++++---- src/config.ts | 10 +++++----- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 76ce5b2..bb0d782 100644 --- a/README.md +++ b/README.md @@ -28,13 +28,15 @@ sensible defaults. # default: empty 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" - 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" - add-job-hash: "" + add-rust-environment-hash-key: "" # A whitespace separated list of env-var *prefixes* who's value contributes # to the environment cache key. diff --git a/action.yml b/action.yml index 5960a0e..a2e3b5c 100644 --- a/action.yml +++ b/action.yml @@ -12,12 +12,12 @@ inputs: key: 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 - use-job-key: - description: "If the automatic `job`-based cache key should be used for the cache name. Defaults to true." + add-job-id-key: + description: "If the automatic `job`-based cache key should include the job id. Defaults to true." required: false default: "true" - add-job-hash: - description: "If the automatic `job`-based cache key should include a hash of the job's contents. Defaults to false." + add-rust-environment-hash-key: + 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 default: "true" env-vars: diff --git a/src/config.ts b/src/config.ts index e6f7c79..620a548 100644 --- a/src/config.ts +++ b/src/config.ts @@ -69,7 +69,7 @@ export class CacheConfig { } 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}`; } } @@ -116,8 +116,8 @@ export class CacheConfig { self.keyEnvs = keyEnvs; - // Add job hash suffix if 'add-job-hash' is true - if (core.getInput("add-job-hash").toLowerCase() == "true") { + // Add job hash suffix if 'add-rust-environment-hash-key' is true + if (core.getInput("add-rust-environment-hash-key").toLowerCase() == "true") { key += `-${digest(hasher)}`; } @@ -244,8 +244,8 @@ export class CacheConfig { keyFiles.push(...parsedKeyFiles); self.keyFiles = sort_and_uniq(keyFiles); - // Add lock hash suffix if 'add-job-hash' is true - if (core.getInput("add-job-hash").toLowerCase() == "true") { + // 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}`; }