From 295c44fece0890f1e0acf5d90d36e07539aacbfe Mon Sep 17 00:00:00 2001 From: Kieron Briggs Date: Mon, 12 Jan 2026 21:58:58 +1100 Subject: [PATCH] Compare case-insenitively for full cache key match Some self-hosted (or otherwise non-github-hosted) runners are non-case-preserving for cache keys. To support such configurations, set the `cache-hit` output variable to `true` if the found cache key matches case-insenitively. Fixes: https://github.com/Swatinem/rust-cache/issues/302 --- dist/restore/index.js | 4 +++- src/restore.ts | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/dist/restore/index.js b/dist/restore/index.js index f52e524..445662f 100644 --- a/dist/restore/index.js +++ b/dist/restore/index.js @@ -151432,7 +151432,9 @@ async function run() { lookupOnly, }); if (restoreKey) { - const match = restoreKey === key; + const match = restoreKey.localeCompare(key, undefined, { + sensitivity: "accent" + }) === 0; lib_core.info(`${lookupOnly ? "Found" : "Restored from"} cache key "${restoreKey}" full match: ${match}.`); if (!match) { // pre-clean the target directory on cache mismatch diff --git a/src/restore.ts b/src/restore.ts index 21af56f..2e680bc 100644 --- a/src/restore.ts +++ b/src/restore.ts @@ -42,7 +42,9 @@ async function run() { lookupOnly, }); if (restoreKey) { - const match = restoreKey === key; + const match = restoreKey.localeCompare(key, undefined, { + sensitivity: "accent" + }) === 0; core.info(`${lookupOnly ? "Found" : "Restored from"} cache key "${restoreKey}" full match: ${match}.`); if (!match) { // pre-clean the target directory on cache mismatch