mirror of
				https://github.com/actions/cache.git
				synced 2025-10-23 08:56:26 +08:00 
			
		
		
		
	review comments and updated test cases
This commit is contained in:
		| @@ -6,17 +6,7 @@ import * as utils from "./utils/actionUtils"; | ||||
|  | ||||
| async function run(): Promise<void> { | ||||
|     try { | ||||
|         if (!cache.isAvailable()) { | ||||
|             if (utils.isGhes()){ | ||||
|                 utils.logWarning( | ||||
|                     "Cache action is only supported on GHES version >= 3.5. If you are on version >=3.5 Please check with GHES admin if ArtifactCache service is enabled or not." | ||||
|                 ); | ||||
|             } | ||||
|             else{ | ||||
|                 utils.logWarning( | ||||
|                     "Something is going wrong with ArtifactCache service which supports cache actions. Please check https://www.githubstatus.com/ for any ongoing issue in actions." | ||||
|                 ); | ||||
|             } | ||||
|         if (!utils.isCacheFeatureAvailable()) { | ||||
|             utils.setCacheHitOutput(false); | ||||
|             return; | ||||
|         } | ||||
|   | ||||
							
								
								
									
										13
									
								
								src/save.ts
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								src/save.ts
									
									
									
									
									
								
							| @@ -11,18 +11,7 @@ process.on("uncaughtException", e => utils.logWarning(e.message)); | ||||
|  | ||||
| async function run(): Promise<void> { | ||||
|     try { | ||||
|         if (!cache.isAvailable()) { | ||||
|             if (utils.isGhes()){ | ||||
|                 utils.logWarning( | ||||
|                     "Cache action is only supported on GHES version >= 3.5. If you are on version >=3.5 Please check with GHES admin if ArtifactCache service is enabled or not." | ||||
|                 ); | ||||
|             } | ||||
|             else{ | ||||
|                 utils.logWarning( | ||||
|                     "Something is going wrong with ArtifactCache service which supports cache actions. Please check https://www.githubstatus.com/ for any ongoing issue in actions." | ||||
|                 ); | ||||
|             } | ||||
|             utils.setCacheHitOutput(false); | ||||
|         if (!utils.isCacheFeatureAvailable()) { | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|   | ||||
| @@ -1,6 +1,7 @@ | ||||
| import * as core from "@actions/core"; | ||||
|  | ||||
| import { Outputs, RefKey, State } from "../constants"; | ||||
| import * as cache from "@actions/cache"; | ||||
|  | ||||
| export function isGhes(): boolean { | ||||
|     const ghUrl = new URL( | ||||
| @@ -74,3 +75,21 @@ export function getInputAsInt( | ||||
|     } | ||||
|     return value; | ||||
| } | ||||
|  | ||||
| export function isCacheFeatureAvailable(): boolean { | ||||
|     if (!cache.isFeatureAvailable()) { | ||||
|         if (isGhes()){ | ||||
|             logWarning( | ||||
|                 "Cache action is only supported on GHES version >= 3.5. If you are on version >=3.5 Please check with GHES admin if ArtifactCache service is enabled or not." | ||||
|             ); | ||||
|         } | ||||
|         else{ | ||||
|             logWarning( | ||||
|                 "An internal error has occurred in cache backend. Please check https://www.githubstatus.com/ for any ongoing issue in actions." | ||||
|             ); | ||||
|         } | ||||
|         return false; | ||||
|     } | ||||
|  | ||||
|     return true; | ||||
| } | ||||
		Reference in New Issue
	
	Block a user