mirror of
https://github.com/actions/setup-java.git
synced 2025-04-20 09:56:46 +00:00
refactor: Use early return pattern
Signed-off-by: jongwooo <jongwooo.han@gmail.com>
This commit is contained in:
parent
c3ac5dd0ed
commit
32b1479849
3 changed files with 24 additions and 29 deletions
21
src/util.ts
21
src/util.ts
|
@ -85,17 +85,16 @@ export function isGhes(): boolean {
|
|||
}
|
||||
|
||||
export function isCacheFeatureAvailable(): boolean {
|
||||
if (!cache.isFeatureAvailable()) {
|
||||
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.'
|
||||
);
|
||||
} else {
|
||||
core.warning('The runner was not able to contact the cache service. Caching will be skipped');
|
||||
}
|
||||
|
||||
return false;
|
||||
if (cache.isFeatureAvailable()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
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('The runner was not able to contact the cache service. Caching will be skipped');
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue