diff --git a/dist/setup/index.js b/dist/setup/index.js index 6cf4871d..1901d1a1 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -67057,16 +67057,14 @@ function isGhes() { } exports.isGhes = isGhes; function isCacheFeatureAvailable() { - if (!cache.isFeatureAvailable()) { - if (isGhes()) { - throw new Error('Caching is only supported on GHES version >= 3.5. If you are on a version >= 3.5, please check with your GHES admin if the Actions cache service is enabled or not.'); - } - else { - core.warning('The runner was not able to contact the cache service. Caching will be skipped'); - } - return false; + if (cache.isFeatureAvailable()) { + return true; } - return true; + if (isGhes()) { + throw new Error('Caching is only supported on GHES version >= 3.5. If you are on a version >= 3.5, please check with your GHES admin if the Actions cache service is enabled or not.'); + } + core.warning('The runner was not able to contact the cache service. Caching will be skipped'); + return false; } exports.isCacheFeatureAvailable = isCacheFeatureAvailable; function logWarning(message) { diff --git a/src/utils.ts b/src/utils.ts index 37059cb6..bc2e8798 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -105,21 +105,20 @@ export function isGhes(): boolean { } export function isCacheFeatureAvailable(): boolean { - if (!cache.isFeatureAvailable()) { - if (isGhes()) { - throw new Error( - 'Caching is only supported on GHES version >= 3.5. If you are on a version >= 3.5, please check with your GHES admin if the Actions cache service is enabled or not.' - ); - } else { - core.warning( - 'The runner was not able to contact the cache service. Caching will be skipped' - ); - } - - return false; + if (cache.isFeatureAvailable()) { + return true; } - return true; + if (isGhes()) { + throw new Error( + 'Caching is only supported on GHES version >= 3.5. If you are on a version >= 3.5, please check with your GHES admin if the Actions cache service is enabled or not.' + ); + } + + core.warning( + 'The runner was not able to contact the cache service. Caching will be skipped' + ); + return false; } export function logWarning(message: string): void {