mirror of
https://github.com/actions/setup-java.git
synced 2025-04-21 18:36:46 +00:00
fix: Replace throw with warn
Signed-off-by: jongwooo <jongwooo.han@gmail.com>
This commit is contained in:
parent
32b1479849
commit
0423e9389b
4 changed files with 11 additions and 9 deletions
|
@ -29,14 +29,13 @@ describe('isVersionSatisfies', () => {
|
||||||
describe('isCacheFeatureAvailable', () => {
|
describe('isCacheFeatureAvailable', () => {
|
||||||
it('isCacheFeatureAvailable disabled on GHES', () => {
|
it('isCacheFeatureAvailable disabled on GHES', () => {
|
||||||
jest.spyOn(cache, 'isFeatureAvailable').mockImplementation(() => false);
|
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 {
|
try {
|
||||||
process.env['GITHUB_SERVER_URL'] = 'http://example.com';
|
process.env['GITHUB_SERVER_URL'] = 'http://example.com';
|
||||||
isCacheFeatureAvailable();
|
expect(isCacheFeatureAvailable()).toBeFalsy();
|
||||||
} catch (error) {
|
expect(infoMock).toHaveBeenCalledWith(message);
|
||||||
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.'
|
|
||||||
);
|
|
||||||
} finally {
|
} finally {
|
||||||
delete process.env['GITHUB_SERVER_URL'];
|
delete process.env['GITHUB_SERVER_URL'];
|
||||||
}
|
}
|
||||||
|
|
3
dist/cleanup/index.js
vendored
3
dist/cleanup/index.js
vendored
|
@ -68710,7 +68710,8 @@ function isCacheFeatureAvailable() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (isGhes()) {
|
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');
|
core.warning('The runner was not able to contact the cache service. Caching will be skipped');
|
||||||
return false;
|
return false;
|
||||||
|
|
3
dist/setup/index.js
vendored
3
dist/setup/index.js
vendored
|
@ -105403,7 +105403,8 @@ function isCacheFeatureAvailable() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (isGhes()) {
|
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');
|
core.warning('The runner was not able to contact the cache service. Caching will be skipped');
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -90,9 +90,10 @@ export function isCacheFeatureAvailable(): boolean {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isGhes()) {
|
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.'
|
'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');
|
core.warning('The runner was not able to contact the cache service. Caching will be skipped');
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue