mirror of https://github.com/actions/setup-go.git
fix: Replace throw with warn
Signed-off-by: jongwooo <jongwooo.han@gmail.com>
This commit is contained in:
parent
ec819f6ce5
commit
fff60808d0
|
@ -162,7 +162,7 @@ describe('isCacheFeatureAvailable', () => {
|
||||||
expect(functionResult).toBeFalsy();
|
expect(functionResult).toBeFalsy();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should throw when cache feature is unavailable and GHES is used', () => {
|
it('should warn when cache feature is unavailable and GHES is used', () => {
|
||||||
//Arrange
|
//Arrange
|
||||||
isFeatureAvailableSpy.mockImplementation(() => {
|
isFeatureAvailableSpy.mockImplementation(() => {
|
||||||
return false;
|
return false;
|
||||||
|
@ -170,10 +170,11 @@ describe('isCacheFeatureAvailable', () => {
|
||||||
|
|
||||||
process.env['GITHUB_SERVER_URL'] = 'https://nongithub.com';
|
process.env['GITHUB_SERVER_URL'] = 'https://nongithub.com';
|
||||||
|
|
||||||
let errorMessage =
|
let warningMessage =
|
||||||
'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.';
|
'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.';
|
||||||
|
|
||||||
//Act + Assert
|
//Act + Assert
|
||||||
expect(() => cacheUtils.isCacheFeatureAvailable()).toThrow(errorMessage);
|
expect(cacheUtils.isCacheFeatureAvailable()).toBeFalsy();
|
||||||
|
expect(warningSpy).toHaveBeenCalledWith(warningMessage);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -60475,7 +60475,8 @@ function isCacheFeatureAvailable() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (isGhes()) {
|
if (isGhes()) {
|
||||||
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.');
|
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.');
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
core.warning('The runner was not able to contact the cache service. Caching will be skipped');
|
core.warning('The runner was not able to contact the cache service. Caching will be skipped');
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -63148,7 +63148,8 @@ function isCacheFeatureAvailable() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (isGhes()) {
|
if (isGhes()) {
|
||||||
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.');
|
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.');
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
core.warning('The runner was not able to contact the cache service. Caching will be skipped');
|
core.warning('The runner was not able to contact the cache service. Caching will be skipped');
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -62,9 +62,10 @@ export function isCacheFeatureAvailable(): boolean {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isGhes()) {
|
if (isGhes()) {
|
||||||
throw new Error(
|
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.'
|
'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.'
|
||||||
);
|
);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
core.warning(
|
core.warning(
|
||||||
|
|
Loading…
Reference in New Issue