mirror of
https://github.com/Swatinem/rust-cache
synced 2026-04-28 16:33:36 +00:00
Compare case-insenitively for full cache key match (#303)
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
This commit is contained in:
parent
5e4a767433
commit
11da8522bc
2 changed files with 6 additions and 2 deletions
4
dist/restore/index.js
vendored
4
dist/restore/index.js
vendored
|
|
@ -151483,7 +151483,9 @@ async function run() {
|
||||||
lookupOnly,
|
lookupOnly,
|
||||||
});
|
});
|
||||||
if (restoreKey) {
|
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}.`);
|
lib_core.info(`${lookupOnly ? "Found" : "Restored from"} cache key "${restoreKey}" full match: ${match}.`);
|
||||||
if (!match) {
|
if (!match) {
|
||||||
// pre-clean the target directory on cache mismatch
|
// pre-clean the target directory on cache mismatch
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,9 @@ async function run() {
|
||||||
lookupOnly,
|
lookupOnly,
|
||||||
});
|
});
|
||||||
if (restoreKey) {
|
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}.`);
|
core.info(`${lookupOnly ? "Found" : "Restored from"} cache key "${restoreKey}" full match: ${match}.`);
|
||||||
if (!match) {
|
if (!match) {
|
||||||
// pre-clean the target directory on cache mismatch
|
// pre-clean the target directory on cache mismatch
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue