Skip to content

Commit f62a0e2

Browse files
Change missing cache directory error to warning (#1182)
* update error to warning when no dependency to cache * updated the return
1 parent 9322b3c commit f62a0e2

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

dist/cache-save/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87883,7 +87883,8 @@ function saveCache(packageManager) {
8788387883
const cachePaths = JSON.parse(cachePathState);
8788487884
core.debug(`paths for caching are ${cachePaths.join(', ')}`);
8788587885
if (!isCacheDirectoryExists(cachePaths)) {
87886-
throw new Error(`Cache folder path is retrieved for ${packageManager} but doesn't exist on disk: ${cachePaths.join(', ')}. This likely indicates that there are no dependencies to cache. Consider removing the cache step if it is not needed.`);
87886+
core.warning(`Cache folder path is retrieved for ${packageManager} but doesn't exist on disk: ${cachePaths.join(', ')}. This likely indicates that there are no dependencies to cache. Consider removing the cache step if it is not needed.`);
87887+
return;
8788787888
}
8788887889
const primaryKey = core.getState(cache_distributor_1.State.STATE_CACHE_PRIMARY_KEY);
8788987890
const matchedKey = core.getState(cache_distributor_1.State.CACHE_MATCHED_KEY);

src/cache-save.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,12 @@ async function saveCache(packageManager: string) {
3838
core.debug(`paths for caching are ${cachePaths.join(', ')}`);
3939

4040
if (!isCacheDirectoryExists(cachePaths)) {
41-
throw new Error(
41+
core.warning(
4242
`Cache folder path is retrieved for ${packageManager} but doesn't exist on disk: ${cachePaths.join(
4343
', '
4444
)}. This likely indicates that there are no dependencies to cache. Consider removing the cache step if it is not needed.`
4545
);
46+
return;
4647
}
4748

4849
const primaryKey = core.getState(State.STATE_CACHE_PRIMARY_KEY);

0 commit comments

Comments
 (0)