mirror of
				https://github.com/actions/setup-node.git
				synced 2025-11-01 00:23:59 +08:00 
			
		
		
		
	Update cache-save.ts to support @actions/cache v3.0.0 lib
This commit is contained in:
		
							
								
								
									
										18
									
								
								dist/cache-save/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										18
									
								
								dist/cache-save/index.js
									
									
									
									
										vendored
									
									
								
							| @@ -59888,21 +59888,11 @@ const cachePackages = (packageManager) => __awaiter(void 0, void 0, void 0, func | |||||||
|         core.info(`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`); |         core.info(`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`); | ||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
|     try { |     const cacheId = yield cache.saveCache([cachePath], primaryKey); | ||||||
|         yield cache.saveCache([cachePath], primaryKey); |     if (cacheId == -1) { | ||||||
|         core.info(`Cache saved with the key: ${primaryKey}`); |         return; | ||||||
|     } |  | ||||||
|     catch (error) { |  | ||||||
|         if (error.name === cache.ValidationError.name) { |  | ||||||
|             throw error; |  | ||||||
|         } |  | ||||||
|         else if (error.name === cache.ReserveCacheError.name) { |  | ||||||
|             core.info(error.message); |  | ||||||
|         } |  | ||||||
|         else { |  | ||||||
|             core.warning(`${error.message}`); |  | ||||||
|         } |  | ||||||
|     } |     } | ||||||
|  |     core.info(`Cache saved with the key: ${primaryKey}`); | ||||||
| }); | }); | ||||||
| run(); | run(); | ||||||
| 
 | 
 | ||||||
|   | |||||||
| @@ -49,18 +49,12 @@ const cachePackages = async (packageManager: string) => { | |||||||
|     return; |     return; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   try { |   const cacheId = await cache.saveCache([cachePath], primaryKey); | ||||||
|     await cache.saveCache([cachePath], primaryKey); |   if (cacheId == -1) { | ||||||
|     core.info(`Cache saved with the key: ${primaryKey}`); |     return; | ||||||
|   } catch (error) { |  | ||||||
|     if (error.name === cache.ValidationError.name) { |  | ||||||
|       throw error; |  | ||||||
|     } else if (error.name === cache.ReserveCacheError.name) { |  | ||||||
|       core.info(error.message); |  | ||||||
|     } else { |  | ||||||
|       core.warning(`${error.message}`); |  | ||||||
|     } |  | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  |   core.info(`Cache saved with the key: ${primaryKey}`); | ||||||
| }; | }; | ||||||
|  |  | ||||||
| run(); | run(); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 IvanZosimov
					IvanZosimov