mirror of
				https://github.com/actions/cache.git
				synced 2025-10-31 07:16:24 +07:00 
			
		
		
		
	Compare commits
	
		
			19 Commits
		
	
	
		
			v4.0.1
			...
			Link-/blob
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 67b144e17c | |||
| ae82de5d80 | |||
| 92c0d581d5 | |||
| 15ed468872 | |||
| 2fbb473cf9 | |||
| d8dede30d8 | |||
| 313eb59159 | |||
| 07e50f1839 | |||
| b4b70a7f57 | |||
| b88a5b44f3 | |||
| 643d6d6123 | |||
| f7e6edf3a0 | |||
| 270eaa9768 | |||
| a2aae2e903 | |||
| 2c0830523b | |||
| 0c45773b62 | |||
| 8a55f839aa | |||
| 3884cace14 | |||
| e29dad3e36 | 
| @ -1,5 +1,9 @@ | ||||
| # Releases | ||||
|  | ||||
| ### 4.0.2 | ||||
|  | ||||
| - Fixed restore `fail-on-cache-miss` not working. | ||||
|  | ||||
| ### 4.0.1 | ||||
|  | ||||
| - Updated `isGhes` check | ||||
|  | ||||
| @ -449,3 +449,19 @@ test("restore with lookup-only set", async () => { | ||||
|     ); | ||||
|     expect(failedMock).toHaveBeenCalledTimes(0); | ||||
| }); | ||||
|  | ||||
| test("restore failure with earlyExit should call process exit", async () => { | ||||
|     testUtils.setInput(Inputs.Path, "node_modules"); | ||||
|     const failedMock = jest.spyOn(core, "setFailed"); | ||||
|     const restoreCacheMock = jest.spyOn(cache, "restoreCache"); | ||||
|     const processExitMock = jest.spyOn(process, "exit").mockImplementation(); | ||||
|  | ||||
|     // call restoreImpl with `earlyExit` set to true | ||||
|     await restoreImpl(new StateProvider(), true); | ||||
|  | ||||
|     expect(restoreCacheMock).toHaveBeenCalledTimes(0); | ||||
|     expect(failedMock).toHaveBeenCalledWith( | ||||
|         "Input required and not supplied: key" | ||||
|     ); | ||||
|     expect(processExitMock).toHaveBeenCalledWith(1); | ||||
| }); | ||||
|  | ||||
							
								
								
									
										70902
									
								
								dist/restore-only/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										70902
									
								
								dist/restore-only/index.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										70902
									
								
								dist/restore/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										70902
									
								
								dist/restore/index.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										70887
									
								
								dist/save-only/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										70887
									
								
								dist/save-only/index.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										70887
									
								
								dist/save/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										70887
									
								
								dist/save/index.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										984
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										984
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										10
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								package.json
									
									
									
									
									
								
							| @ -1,6 +1,6 @@ | ||||
| { | ||||
|   "name": "cache", | ||||
|   "version": "4.0.1", | ||||
|   "version": "4.0.2", | ||||
|   "private": true, | ||||
|   "description": "Cache dependencies and build outputs", | ||||
|   "main": "dist/restore/index.js", | ||||
| @ -23,10 +23,10 @@ | ||||
|   "author": "GitHub", | ||||
|   "license": "MIT", | ||||
|   "dependencies": { | ||||
|     "@actions/cache": "^3.2.3", | ||||
|     "@actions/core": "^1.10.0", | ||||
|     "@actions/exec": "^1.1.1", | ||||
|     "@actions/io": "^1.1.2" | ||||
|     "@actions/cache": "file:/workspaces/toolkit/packages/cache", | ||||
|     "@actions/core": "file:/workspaces/toolkit/packages/core", | ||||
|     "@actions/exec": "file:/workspaces/toolkit/packages/exec", | ||||
|     "@actions/io": "file:/workspaces/toolkit/packages/io" | ||||
|   }, | ||||
|   "devDependencies": { | ||||
|     "@types/jest": "^27.5.2", | ||||
|  | ||||
| @ -10,7 +10,8 @@ import { | ||||
| import * as utils from "./utils/actionUtils"; | ||||
|  | ||||
| export async function restoreImpl( | ||||
|     stateProvider: IStateProvider | ||||
|     stateProvider: IStateProvider, | ||||
|     earlyExit?: boolean | undefined | ||||
| ): Promise<string | undefined> { | ||||
|     try { | ||||
|         if (!utils.isCacheFeatureAvailable()) { | ||||
| @ -83,6 +84,9 @@ export async function restoreImpl( | ||||
|         return cacheKey; | ||||
|     } catch (error: unknown) { | ||||
|         core.setFailed((error as Error).message); | ||||
|         if (earlyExit) { | ||||
|             process.exit(1); | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -90,14 +94,7 @@ async function run( | ||||
|     stateProvider: IStateProvider, | ||||
|     earlyExit: boolean | undefined | ||||
| ): Promise<void> { | ||||
|     try { | ||||
|         await restoreImpl(stateProvider); | ||||
|     } catch (err) { | ||||
|         console.error(err); | ||||
|         if (earlyExit) { | ||||
|             process.exit(1); | ||||
|         } | ||||
|     } | ||||
|     await restoreImpl(stateProvider, earlyExit); | ||||
|  | ||||
|     // node will stay alive if any promises are not resolved, | ||||
|     // which is a possibility if HTTP requests are dangling | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	