mirror of
https://github.com/actions/setup-python.git
synced 2025-04-20 03:53:30 +00:00
refactor: Use early return pattern
Signed-off-by: jongwooo <jongwooo.han@gmail.com>
This commit is contained in:
parent
2c3dd9e7e2
commit
8606abc738
8
dist/setup/index.js
vendored
8
dist/setup/index.js
vendored
@ -67057,16 +67057,14 @@ function isGhes() {
|
|||||||
}
|
}
|
||||||
exports.isGhes = isGhes;
|
exports.isGhes = isGhes;
|
||||||
function isCacheFeatureAvailable() {
|
function isCacheFeatureAvailable() {
|
||||||
if (!cache.isFeatureAvailable()) {
|
if (cache.isFeatureAvailable()) {
|
||||||
|
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.');
|
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.');
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
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;
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
exports.isCacheFeatureAvailable = isCacheFeatureAvailable;
|
exports.isCacheFeatureAvailable = isCacheFeatureAvailable;
|
||||||
function logWarning(message) {
|
function logWarning(message) {
|
||||||
|
13
src/utils.ts
13
src/utils.ts
@ -105,21 +105,20 @@ 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(
|
||||||
'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.'
|
||||||
);
|
);
|
||||||
} 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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function logWarning(message: string): void {
|
export function logWarning(message: string): void {
|
||||||
|
Loading…
Reference in New Issue
Block a user