Skip to content

Commit 12c852e

Browse files
authored
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
1 parent 180f8b4 commit 12c852e

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

dist/save-cache/index.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/setup/index.js

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/cache/restore-cache.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ export const STATE_CACHE_KEY = "cache-key";
1414
export const STATE_CACHE_MATCHED_KEY = "cache-matched-key";
1515
const CACHE_VERSION = "1";
1616

17-
export async function restoreCache(version: string): Promise<void> {
18-
const cacheKey = await computeKeys(version);
17+
export async function restoreCache(): Promise<void> {
18+
const cacheKey = await computeKeys();
1919

2020
let matchedKey: string | undefined;
2121
core.info(
@@ -35,7 +35,7 @@ export async function restoreCache(version: string): Promise<void> {
3535
handleMatchResult(matchedKey, cacheKey);
3636
}
3737

38-
async function computeKeys(version: string): Promise<string> {
38+
async function computeKeys(): Promise<string> {
3939
let cacheDependencyPathHash = "-";
4040
if (cacheDependencyGlob !== "") {
4141
core.info(
@@ -53,7 +53,7 @@ async function computeKeys(version: string): Promise<string> {
5353
}
5454
const suffix = cacheSuffix ? `-${cacheSuffix}` : "";
5555
const pythonVersion = await getPythonVersion();
56-
return `setup-uv-${CACHE_VERSION}-${getArch()}-${getPlatform()}-${version}-${pythonVersion}${cacheDependencyPathHash}${suffix}`;
56+
return `setup-uv-${CACHE_VERSION}-${getArch()}-${getPlatform()}-${pythonVersion}${cacheDependencyPathHash}${suffix}`;
5757
}
5858

5959
async function getPythonVersion(): Promise<string> {

src/setup-uv.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ async function run(): Promise<void> {
5555
core.info(`Successfully installed uv version ${setupResult.version}`);
5656

5757
if (enableCache) {
58-
await restoreCache(setupResult.version);
58+
await restoreCache();
5959
}
6060
process.exit(0);
6161
} catch (err) {

0 commit comments

Comments
 (0)