mirror of
				https://github.com/actions/setup-node.git
				synced 2025-11-04 05:19:11 +08:00 
			
		
		
		
	Add fix for cache (#917)
This commit is contained in:
		
							
								
								
									
										3451
									
								
								dist/cache-save/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3451
									
								
								dist/cache-save/index.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -12,10 +12,20 @@ process.on('uncaughtException', e => {
 | 
				
			|||||||
  core.info(`${warningPrefix}${e.message}`);
 | 
					  core.info(`${warningPrefix}${e.message}`);
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export async function run() {
 | 
					// Added early exit to resolve issue with slow post action step:
 | 
				
			||||||
 | 
					export async function run(earlyExit?: boolean) {
 | 
				
			||||||
  try {
 | 
					  try {
 | 
				
			||||||
    const cacheLock = core.getState(State.CachePackageManager);
 | 
					    const cacheLock = core.getState(State.CachePackageManager);
 | 
				
			||||||
    await cachePackages(cacheLock);
 | 
					
 | 
				
			||||||
 | 
					    if (cacheLock) {
 | 
				
			||||||
 | 
					      await cachePackages(cacheLock);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      if (earlyExit) {
 | 
				
			||||||
 | 
					        process.exit(0);
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					      core.debug(`Caching for '${cacheLock}' is not supported`);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
  } catch (error) {
 | 
					  } catch (error) {
 | 
				
			||||||
    core.setFailed((error as Error).message);
 | 
					    core.setFailed((error as Error).message);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@@ -58,4 +68,4 @@ const cachePackages = async (packageManager: string) => {
 | 
				
			|||||||
  core.info(`Cache saved with the key: ${primaryKey}`);
 | 
					  core.info(`Cache saved with the key: ${primaryKey}`);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
run();
 | 
					run(true);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user