diff --git a/__tests__/util.test.ts b/__tests__/util.test.ts index 9815c950..2122563d 100644 --- a/__tests__/util.test.ts +++ b/__tests__/util.test.ts @@ -29,14 +29,13 @@ describe('isVersionSatisfies', () => { describe('isCacheFeatureAvailable', () => { it('isCacheFeatureAvailable disabled on GHES', () => { jest.spyOn(cache, 'isFeatureAvailable').mockImplementation(() => false); + const infoMock = jest.spyOn(core, 'warning'); + const message = + '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.'; try { process.env['GITHUB_SERVER_URL'] = 'http://example.com'; - isCacheFeatureAvailable(); - } catch (error) { - expect(error).toHaveProperty( - 'message', - '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.' - ); + expect(isCacheFeatureAvailable()).toBeFalsy(); + expect(infoMock).toHaveBeenCalledWith(message); } finally { delete process.env['GITHUB_SERVER_URL']; } diff --git a/dist/cleanup/index.js b/dist/cleanup/index.js index 5adbf1d3..c40845de 100644 --- a/dist/cleanup/index.js +++ b/dist/cleanup/index.js @@ -68710,7 +68710,8 @@ function isCacheFeatureAvailable() { 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('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.'); + return false; } core.warning('The runner was not able to contact the cache service. Caching will be skipped'); return false; diff --git a/dist/setup/index.js b/dist/setup/index.js index 4dc3a413..1a71a27f 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -105403,7 +105403,8 @@ function isCacheFeatureAvailable() { 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('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.'); + return false; } core.warning('The runner was not able to contact the cache service. Caching will be skipped'); return false; diff --git a/src/util.ts b/src/util.ts index de3cf618..6a90d43f 100644 --- a/src/util.ts +++ b/src/util.ts @@ -90,9 +90,10 @@ export function isCacheFeatureAvailable(): boolean { } if (isGhes()) { - throw new Error( + core.warning( '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.' ); + return false; } core.warning('The runner was not able to contact the cache service. Caching will be skipped');