diff --git a/__tests__/cache-utils.test.ts b/__tests__/cache-utils.test.ts index cb2c4e46..58afa43c 100644 --- a/__tests__/cache-utils.test.ts +++ b/__tests__/cache-utils.test.ts @@ -11,6 +11,7 @@ describe('cache-utils', () => { let getCommandOutputSpy: jest.SpyInstance; let isFeatureAvailable: jest.SpyInstance; let info: jest.SpyInstance; + let warningSpy: jest.SpyInstance; beforeEach(() => { process.env['GITHUB_WORKSPACE'] = path.join(__dirname, 'data'); @@ -18,6 +19,7 @@ describe('cache-utils', () => { debugSpy.mockImplementation(msg => {}); info = jest.spyOn(core, 'info'); + warningSpy = jest.spyOn(core, 'warning'); isFeatureAvailable = jest.spyOn(cache, 'isFeatureAvailable'); @@ -52,8 +54,8 @@ describe('cache-utils', () => { it('isCacheFeatureAvailable for GHES has an interhal error', () => { isFeatureAvailable.mockImplementation(() => false); process.env['GITHUB_SERVER_URL'] = ''; - - expect(() => isCacheFeatureAvailable()).toThrowError( + isCacheFeatureAvailable(); + expect(warningSpy).toHaveBeenCalledWith( 'An internal error has occurred in cache backend. Please check https://www.githubstatus.com/ for any ongoing issue in actions.' ); }); diff --git a/__tests__/installer.test.ts b/__tests__/installer.test.ts index 54d63da5..67ea6d63 100644 --- a/__tests__/installer.test.ts +++ b/__tests__/installer.test.ts @@ -686,8 +686,8 @@ describe('setup-node', () => { await main.run(); - expect(cnSpy).toHaveBeenCalledWith( - `::error::An internal error has occurred in cache backend. Please check https://www.githubstatus.com/ for any ongoing issue in actions.${osm.EOL}` + expect(warningSpy).toHaveBeenCalledWith( + 'An internal error has occurred in cache backend. Please check https://www.githubstatus.com/ for any ongoing issue in actions.' ); }); }); diff --git a/dist/cache-save/index.js b/dist/cache-save/index.js index 3f049ebe..eea2a47f 100644 --- a/dist/cache-save/index.js +++ b/dist/cache-save/index.js @@ -3884,8 +3884,9 @@ function isCacheFeatureAvailable() { throw new Error('Cache action is only supported on GHES version >= 3.5. If you are on version >=3.5 Please check with GHES admin if Actions cache service is enabled or not.'); } else { - throw new Error('An internal error has occurred in cache backend. Please check https://www.githubstatus.com/ for any ongoing issue in actions.'); + core.warning('An internal error has occurred in cache backend. Please check https://www.githubstatus.com/ for any ongoing issue in actions.'); } + return false; } return true; } diff --git a/dist/setup/index.js b/dist/setup/index.js index 8a1610b0..5bd90061 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -46137,8 +46137,9 @@ function isCacheFeatureAvailable() { throw new Error('Cache action is only supported on GHES version >= 3.5. If you are on version >=3.5 Please check with GHES admin if Actions cache service is enabled or not.'); } else { - throw new Error('An internal error has occurred in cache backend. Please check https://www.githubstatus.com/ for any ongoing issue in actions.'); + core.warning('An internal error has occurred in cache backend. Please check https://www.githubstatus.com/ for any ongoing issue in actions.'); } + return false; } return true; } diff --git a/src/cache-utils.ts b/src/cache-utils.ts index 31a2eb9f..1f5659f2 100644 --- a/src/cache-utils.ts +++ b/src/cache-utils.ts @@ -111,10 +111,12 @@ export function isCacheFeatureAvailable(): boolean { 'Cache action is only supported on GHES version >= 3.5. If you are on version >=3.5 Please check with GHES admin if Actions cache service is enabled or not.' ); } else { - throw new Error( + core.warning( 'An internal error has occurred in cache backend. Please check https://www.githubstatus.com/ for any ongoing issue in actions.' ); } + + return false; } return true;