mirror of
https://github.com/actions/setup-node
synced 2025-04-19 22:53:12 +00:00
Show warning instead of failure when cache is not reachable
This commit is contained in:
parent
eeb10cff27
commit
dfc4b745b4
@ -46,7 +46,8 @@ describe('cache-utils', () => {
|
||||
isFeatureAvailable.mockImplementation(() => false);
|
||||
process.env['GITHUB_SERVER_URL'] = 'https://www.test.com';
|
||||
|
||||
expect(() => isCacheFeatureAvailable()).toThrowError(
|
||||
isCacheFeatureAvailable();
|
||||
expect(warningSpy).toHaveBeenCalledWith(
|
||||
'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.'
|
||||
);
|
||||
});
|
||||
|
@ -644,8 +644,8 @@ describe('setup-node', () => {
|
||||
|
||||
await main.run();
|
||||
|
||||
expect(cnSpy).toHaveBeenCalledWith(
|
||||
`::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}`
|
||||
expect(warningSpy).toHaveBeenCalledWith(
|
||||
'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.'
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -107,7 +107,7 @@ export function isGhes(): boolean {
|
||||
export function isCacheFeatureAvailable(): boolean {
|
||||
if (!cache.isFeatureAvailable()) {
|
||||
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.'
|
||||
);
|
||||
} else {
|
||||
|
10
src/main.ts
10
src/main.ts
@ -16,7 +16,6 @@ export async function run() {
|
||||
let version = resolveVersionInput();
|
||||
|
||||
let arch = core.getInput('architecture');
|
||||
const cache = core.getInput('cache');
|
||||
|
||||
// if architecture supplied but node-version is not
|
||||
// if we don't throw a warning, the already installed x64 node will be used which is not probably what user meant.
|
||||
@ -39,6 +38,13 @@ export async function run() {
|
||||
await installer.getNode(version, stable, checkLatest, auth, arch);
|
||||
}
|
||||
|
||||
} catch (err) {
|
||||
core.setFailed(err.message);
|
||||
}
|
||||
|
||||
try {
|
||||
const cache = core.getInput('cache');
|
||||
|
||||
const registryUrl: string = core.getInput('registry-url');
|
||||
const alwaysAuth: string = core.getInput('always-auth');
|
||||
if (registryUrl) {
|
||||
@ -59,7 +65,7 @@ export async function run() {
|
||||
`##[add-matcher]${path.join(matchersPath, 'eslint-compact.json')}`
|
||||
);
|
||||
} catch (err) {
|
||||
core.setFailed(err.message);
|
||||
core.warning(err.message);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user