You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/save-cache.ts
+27-29Lines changed: 27 additions & 29 deletions
Original file line number
Diff line number
Diff line change
@@ -59,23 +59,40 @@ async function saveCache(): Promise<void> {
59
59
}
60
60
61
61
constactualCachePath=getUvCachePath();
62
-
awaitsaveCacheToKey(
63
-
cacheKey,
64
-
actualCachePath,
65
-
STATE_CACHE_MATCHED_KEY,
66
-
"uv cache",
67
-
`Cache path ${actualCachePath} does not exist on disk. This likely indicates that there are no dependencies to cache. Consider disabling the cache input if it is not needed.`,
68
-
);
62
+
if(!fs.existsSync(actualCachePath)){
63
+
if(ignoreNothingToCache){
64
+
core.info(
65
+
"No cacheable uv cache paths were found. Ignoring because ignore-nothing-to-cache is enabled.",
66
+
);
67
+
}else{
68
+
thrownewError(
69
+
`Cache path ${actualCachePath} does not exist on disk. This likely indicates that there are no dependencies to cache. Consider disabling the cache input if it is not needed.`,
70
+
);
71
+
}
72
+
}else{
73
+
awaitsaveCacheToKey(
74
+
cacheKey,
75
+
actualCachePath,
76
+
STATE_CACHE_MATCHED_KEY,
77
+
"uv cache",
78
+
);
79
+
}
69
80
}
70
81
71
82
if(cachePython){
83
+
if(!fs.existsSync(pythonDir)){
84
+
core.warning(
85
+
`Python cache path ${pythonDir} does not exist on disk. Skipping Python cache save because no managed Python installation was found. If you want uv to install managed Python instead of using a system interpreter, set UV_PYTHON_PREFERENCE=only-managed.`,
86
+
);
87
+
return;
88
+
}
89
+
72
90
constpythonCacheKey=`${cacheKey}-python`;
73
91
awaitsaveCacheToKey(
74
92
pythonCacheKey,
75
93
pythonDir,
76
94
STATE_PYTHON_CACHE_MATCHED_KEY,
77
95
"Python cache",
78
-
`Python cache path ${pythonDir} does not exist on disk. This likely indicates that there are no Python installations to cache. Consider disabling the cache input if it is not needed.`,
79
96
);
80
97
}
81
98
}
@@ -119,7 +136,6 @@ async function saveCacheToKey(
119
136
cachePath: string,
120
137
stateKey: string,
121
138
cacheName: string,
122
-
pathNotExistErrorMessage: string,
123
139
): Promise<void>{
124
140
constmatchedKey=core.getState(stateKey);
125
141
@@ -131,26 +147,8 @@ async function saveCacheToKey(
0 commit comments