mirror of
				https://github.com/actions/setup-java.git
				synced 2025-11-04 00:10:54 +00:00 
			
		
		
		
	use the key in state to save caches in the post process
This commit is contained in:
		
					parent
					
						
							
								6977c031ae
							
						
					
				
			
			
				commit
				
					
						7fe6c4d631
					
				
			
		
					 5 changed files with 102 additions and 17 deletions
				
			
		
							
								
								
									
										9
									
								
								dist/setup/index.js
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										9
									
								
								dist/setup/index.js
									
										
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -18998,9 +18998,14 @@ exports.restore = restore;
 | 
			
		|||
function save(id) {
 | 
			
		||||
    return __awaiter(this, void 0, void 0, function* () {
 | 
			
		||||
        const packageManager = findPackageManager(id);
 | 
			
		||||
        const primaryKey = yield computeCacheKey(packageManager);
 | 
			
		||||
        const matchedKey = core.getState(CACHE_MATCHED_KEY);
 | 
			
		||||
        if (matchedKey === primaryKey) {
 | 
			
		||||
        // Inputs are re-evaluted before the post action, so we want the original key used for restore
 | 
			
		||||
        const primaryKey = core.getState(STATE_CACHE_PRIMARY_KEY);
 | 
			
		||||
        if (!primaryKey) {
 | 
			
		||||
            core.warning('Error retrieving key from state.');
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        else if (matchedKey === primaryKey) {
 | 
			
		||||
            // no change in target directories
 | 
			
		||||
            core.info(`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`);
 | 
			
		||||
            return;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue