From b9a674e48d5e8d016b8f1d6e5d2ddb34bf9ea59d Mon Sep 17 00:00:00 2001 From: Aparna Jyothi Date: Fri, 20 Sep 2024 15:09:44 +0530 Subject: [PATCH] updated error message --- dist/cache-save/index.js | 4 ++-- dist/setup/index.js | 2 +- src/cache-distributions/cache-distributor.ts | 6 +++++- src/cache-save.ts | 4 ++-- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/dist/cache-save/index.js b/dist/cache-save/index.js index aa4501f9..5ef82dab 100644 --- a/dist/cache-save/index.js +++ b/dist/cache-save/index.js @@ -81041,7 +81041,7 @@ class CacheDistributor { .split('\n') .join(',')} or ${constants_1.CACHE_DEPENDENCY_BACKUP_PATH}` : this.cacheDependencyPath.split('\n').join(','); - throw new Error(`No file in ${process.cwd()} matched to [${file}], make sure you have checked out the target repository`); + throw new Error(`No file in ${process.cwd()} matched to [${file}], make sure you have checked out the target repository. No cache paths were identified for ${this.packageManager} with cache-dependency-path = ${this.cacheDependencyPath}. This likely indicates no dependencies to cache. Consider removing the cache step if it's not needed`); } const cachePath = yield this.getCacheGlobalDirectories(); core.saveState(State.CACHE_PATHS, cachePath); @@ -81165,7 +81165,7 @@ function saveCache(packageManager) { const cachePaths = JSON.parse(cachePathState); core.debug(`paths for caching are ${cachePaths.join(', ')}`); if (!isCacheDirectoryExists(cachePaths)) { - throw new Error(`Cache folder path is retrieved for ${packageManager} but doesn't exist on disk: ${cachePaths.join(', ')}`); + throw new Error(`No file in ${process.cwd()} matched to [${cachePaths.join(', ')}], make sure you have checked out the target repository. No cache paths were identified for ${packageManager} with cache-dependency-path. This likely indicates no dependencies to cache. Consider removing the cache step if it's not needed.`); } const primaryKey = core.getState(cache_distributor_1.State.STATE_CACHE_PRIMARY_KEY); const matchedKey = core.getState(cache_distributor_1.State.CACHE_MATCHED_KEY); diff --git a/dist/setup/index.js b/dist/setup/index.js index f1e3e297..d93e68ee 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -90243,7 +90243,7 @@ class CacheDistributor { .split('\n') .join(',')} or ${constants_1.CACHE_DEPENDENCY_BACKUP_PATH}` : this.cacheDependencyPath.split('\n').join(','); - throw new Error(`No file in ${process.cwd()} matched to [${file}], make sure you have checked out the target repository`); + throw new Error(`No file in ${process.cwd()} matched to [${file}], make sure you have checked out the target repository. No cache paths were identified for ${this.packageManager} with cache-dependency-path = ${this.cacheDependencyPath}. This likely indicates no dependencies to cache. Consider removing the cache step if it's not needed`); } const cachePath = yield this.getCacheGlobalDirectories(); core.saveState(State.CACHE_PATHS, cachePath); diff --git a/src/cache-distributions/cache-distributor.ts b/src/cache-distributions/cache-distributor.ts index 211946fb..842fb708 100644 --- a/src/cache-distributions/cache-distributor.ts +++ b/src/cache-distributions/cache-distributor.ts @@ -32,7 +32,11 @@ abstract class CacheDistributor { .join(',')} or ${CACHE_DEPENDENCY_BACKUP_PATH}` : this.cacheDependencyPath.split('\n').join(','); throw new Error( - `No file in ${process.cwd()} matched to [${file}], make sure you have checked out the target repository` + `No file in ${process.cwd()} matched to [${file}], make sure you have checked out the target repository. No cache paths were identified for ${ + this.packageManager + } with cache-dependency-path = ${ + this.cacheDependencyPath + }. This likely indicates no dependencies to cache. Consider removing the cache step if it's not needed` ); } diff --git a/src/cache-save.ts b/src/cache-save.ts index fbb481c1..6bd44df8 100644 --- a/src/cache-save.ts +++ b/src/cache-save.ts @@ -39,9 +39,9 @@ async function saveCache(packageManager: string) { if (!isCacheDirectoryExists(cachePaths)) { throw new Error( - `Cache folder path is retrieved for ${packageManager} but doesn't exist on disk: ${cachePaths.join( + `No file in ${process.cwd()} matched to [${cachePaths.join( ', ' - )}` + )}], make sure you have checked out the target repository. No cache paths were identified for ${packageManager} with cache-dependency-path. This likely indicates no dependencies to cache. Consider removing the cache step if it's not needed.` ); }