mirror of
				https://github.com/actions/setup-node.git
				synced 2025-11-04 01:33:33 +00:00 
			
		
		
		
	feat(cache) use restoreKeys as backup to hit cache
Fixes
This commit is contained in:
		
							parent
							
								
									41acaa2e85
								
							
						
					
					
						commit
						49141160ec
					
				@ -37,11 +37,13 @@ export const restoreCache = async (
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  const primaryKey = `node-cache-${platform}-${packageManager}-${fileHash}`;
 | 
			
		||||
  const restoreKeys = [`node-cache-${platform}-${packageManager}-`];
 | 
			
		||||
  core.debug(`primary key is ${primaryKey}`);
 | 
			
		||||
  core.debug(`restore keys are [${restoreKeys}]`);
 | 
			
		||||
 | 
			
		||||
  core.saveState(State.CachePrimaryKey, primaryKey);
 | 
			
		||||
 | 
			
		||||
  const cacheKey = await cache.restoreCache([cachePath], primaryKey);
 | 
			
		||||
  const cacheKey = await cache.restoreCache([cachePath], primaryKey, restoreKeys);
 | 
			
		||||
  core.setOutput('cache-hit', Boolean(cacheKey));
 | 
			
		||||
 | 
			
		||||
  if (!cacheKey) {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user