1
0
Fork 0
mirror of https://code.forgejo.org/actions/setup-python synced 2025-06-08 04:18:19 +02:00

refactor: Use early return pattern to avoid nested conditions (#566)

* refactor: Use early return pattern

Signed-off-by: jongwooo <jongwooo.han@gmail.com>

* fix: Replace throw with warn

Signed-off-by: jongwooo <jongwooo.han@gmail.com>

Signed-off-by: jongwooo <jongwooo.han@gmail.com>
This commit is contained in:
Jongwoo Han 2022-12-19 22:00:46 +09:00 committed by GitHub
parent 2c3dd9e7e2
commit 206e984b94
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 25 deletions

15
dist/setup/index.js vendored
View file

@ -67057,16 +67057,15 @@ function isGhes() {
}
exports.isGhes = isGhes;
function isCacheFeatureAvailable() {
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');
}
if (cache.isFeatureAvailable()) {
return true;
}
if (isGhes()) {
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;
}
return true;
core.warning('The runner was not able to contact the cache service. Caching will be skipped');
return false;
}
exports.isCacheFeatureAvailable = isCacheFeatureAvailable;
function logWarning(message) {