Remove uv version from cache key (#206)

This approach was copied from setup-rye but uv now has the capability to
determine if a cache version is compatible. By removing it we will less
frequently invalidate the cache and thus save bandwidth

Closes: #203
This commit is contained in:
Kevin Stillhammer 2024-12-22 12:12:29 +01:00 committed by GitHub
parent 180f8b4439
commit 12c852e6ba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 14 additions and 14 deletions

8
dist/save-cache/index.js generated vendored
View file

@ -91465,9 +91465,9 @@ const exec = __importStar(__nccwpck_require__(5236));
exports.STATE_CACHE_KEY = "cache-key";
exports.STATE_CACHE_MATCHED_KEY = "cache-matched-key";
const CACHE_VERSION = "1";
function restoreCache(version) {
function restoreCache() {
return __awaiter(this, void 0, void 0, function* () {
const cacheKey = yield computeKeys(version);
const cacheKey = yield computeKeys();
let matchedKey;
core.info(`Trying to restore uv cache from GitHub Actions cache with key: ${cacheKey}`);
try {
@ -91483,7 +91483,7 @@ function restoreCache(version) {
handleMatchResult(matchedKey, cacheKey);
});
}
function computeKeys(version) {
function computeKeys() {
return __awaiter(this, void 0, void 0, function* () {
let cacheDependencyPathHash = "-";
if (inputs_1.cacheDependencyGlob !== "") {
@ -91498,7 +91498,7 @@ function computeKeys(version) {
}
const suffix = inputs_1.cacheSuffix ? `-${inputs_1.cacheSuffix}` : "";
const pythonVersion = yield getPythonVersion();
return `setup-uv-${CACHE_VERSION}-${(0, platforms_1.getArch)()}-${(0, platforms_1.getPlatform)()}-${version}-${pythonVersion}${cacheDependencyPathHash}${suffix}`;
return `setup-uv-${CACHE_VERSION}-${(0, platforms_1.getArch)()}-${(0, platforms_1.getPlatform)()}-${pythonVersion}${cacheDependencyPathHash}${suffix}`;
});
}
function getPythonVersion() {