mirror of
				https://github.com/actions/setup-node.git
				synced 2025-11-04 13:29:12 +08:00 
			
		
		
		
	Use early return pattern
This commit is contained in:
		
							
								
								
									
										16
									
								
								dist/cache-save/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										16
									
								
								dist/cache-save/index.js
									
									
									
									
										vendored
									
									
								
							@@ -61185,16 +61185,12 @@ function isGhes() {
 | 
			
		||||
}
 | 
			
		||||
exports.isGhes = isGhes;
 | 
			
		||||
function isCacheFeatureAvailable() {
 | 
			
		||||
    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;
 | 
			
		||||
    if (cache.isFeatureAvailable())
 | 
			
		||||
        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;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										16
									
								
								dist/setup/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										16
									
								
								dist/setup/index.js
									
									
									
									
										vendored
									
									
								
							@@ -73139,16 +73139,12 @@ function isGhes() {
 | 
			
		||||
}
 | 
			
		||||
exports.isGhes = isGhes;
 | 
			
		||||
function isCacheFeatureAvailable() {
 | 
			
		||||
    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;
 | 
			
		||||
    if (cache.isFeatureAvailable())
 | 
			
		||||
        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;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user