mirror of
https://code.forgejo.org/actions/setup-node.git
synced 2024-11-22 08:20:59 -05:00
Use early return pattern
This commit is contained in:
parent
d1b197b965
commit
676975d9aa
3 changed files with 22 additions and 33 deletions
14
dist/cache-save/index.js
vendored
14
dist/cache-save/index.js
vendored
|
@ -61185,16 +61185,12 @@ function isGhes() {
|
||||||
}
|
}
|
||||||
exports.isGhes = isGhes;
|
exports.isGhes = isGhes;
|
||||||
function isCacheFeatureAvailable() {
|
function isCacheFeatureAvailable() {
|
||||||
if (!cache.isFeatureAvailable()) {
|
if (cache.isFeatureAvailable())
|
||||||
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.');
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
core.warning('The runner was not able to contact the cache service. Caching will be skipped');
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
|
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('The runner was not able to contact the cache service. Caching will be skipped');
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
exports.isCacheFeatureAvailable = isCacheFeatureAvailable;
|
exports.isCacheFeatureAvailable = isCacheFeatureAvailable;
|
||||||
|
|
||||||
|
|
14
dist/setup/index.js
vendored
14
dist/setup/index.js
vendored
|
@ -73139,16 +73139,12 @@ function isGhes() {
|
||||||
}
|
}
|
||||||
exports.isGhes = isGhes;
|
exports.isGhes = isGhes;
|
||||||
function isCacheFeatureAvailable() {
|
function isCacheFeatureAvailable() {
|
||||||
if (!cache.isFeatureAvailable()) {
|
if (cache.isFeatureAvailable())
|
||||||
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.');
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
core.warning('The runner was not able to contact the cache service. Caching will be skipped');
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
|
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('The runner was not able to contact the cache service. Caching will be skipped');
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
exports.isCacheFeatureAvailable = isCacheFeatureAvailable;
|
exports.isCacheFeatureAvailable = isCacheFeatureAvailable;
|
||||||
|
|
||||||
|
|
|
@ -105,19 +105,16 @@ export function isGhes(): boolean {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isCacheFeatureAvailable(): boolean {
|
export function isCacheFeatureAvailable(): boolean {
|
||||||
if (!cache.isFeatureAvailable()) {
|
if (cache.isFeatureAvailable()) return true;
|
||||||
if (isGhes()) {
|
|
||||||
|
if (isGhes())
|
||||||
throw new Error(
|
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.'
|
'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 {
|
|
||||||
core.warning(
|
core.warning(
|
||||||
'The runner was not able to contact the cache service. Caching will be skipped'
|
'The runner was not able to contact the cache service. Caching will be skipped'
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue