Skip to content

Commit b28830c

Browse files
committed
replace throw with warn
1 parent 676975d commit b28830c

File tree

5 files changed

+17
-9
lines changed

5 files changed

+17
-9
lines changed

__tests__/cache-utils.test.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ describe('cache-utils', () => {
4646
isFeatureAvailable.mockImplementation(() => false);
4747
process.env['GITHUB_SERVER_URL'] = 'https://www.test.com';
4848

49-
expect(() => isCacheFeatureAvailable()).toThrowError(
49+
expect(isCacheFeatureAvailable()).toBeFalsy();
50+
expect(warningSpy).toHaveBeenCalledWith(
5051
'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.'
5152
);
5253
});

__tests__/installer.test.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -728,8 +728,9 @@ describe('setup-node', () => {
728728

729729
await main.run();
730730

731-
expect(cnSpy).toHaveBeenCalledWith(
732-
`::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.${osm.EOL}`
731+
expect(warningSpy).toHaveBeenCalledWith(
732+
// `::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.${osm.EOL}`
733+
'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.'
733734
);
734735
});
735736

dist/cache-save/index.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -61187,8 +61187,10 @@ exports.isGhes = isGhes;
6118761187
function isCacheFeatureAvailable() {
6118861188
if (cache.isFeatureAvailable())
6118961189
return true;
61190-
if (isGhes())
61191-
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.');
61190+
if (isGhes()) {
61191+
core.warning('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.');
61192+
return false;
61193+
}
6119261194
core.warning('The runner was not able to contact the cache service. Caching will be skipped');
6119361195
return false;
6119461196
}

dist/setup/index.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -73141,8 +73141,10 @@ exports.isGhes = isGhes;
7314173141
function isCacheFeatureAvailable() {
7314273142
if (cache.isFeatureAvailable())
7314373143
return true;
73144-
if (isGhes())
73145-
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.');
73144+
if (isGhes()) {
73145+
core.warning('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.');
73146+
return false;
73147+
}
7314673148
core.warning('The runner was not able to contact the cache service. Caching will be skipped');
7314773149
return false;
7314873150
}

src/cache-utils.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,12 @@ export function isGhes(): boolean {
107107
export function isCacheFeatureAvailable(): boolean {
108108
if (cache.isFeatureAvailable()) return true;
109109

110-
if (isGhes())
111-
throw new Error(
110+
if (isGhes()) {
111+
core.warning(
112112
'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.'
113113
);
114+
return false;
115+
}
114116

115117
core.warning(
116118
'The runner was not able to contact the cache service. Caching will be skipped'

0 commit comments

Comments
 (0)