mirror of
				https://github.com/actions/cache.git
				synced 2025-11-04 13:29:10 +08:00 
			
		
		
		
	Tweak 'Cache not found' message (#54)
Previously the message was like this: ``` Cache not found for input keys: ["xxx",""] ``` Note the empty entry at the end because `String.prototype.split` results in an array with one empty string if there was nothing to split. Now it looks like: ``` Cache not found for input keys: xxx ```
This commit is contained in:
		
				
					committed by
					
						
						Josh Gross
					
				
			
			
				
	
			
			
			
						parent
						
							b034b26a44
						
					
				
				
					commit
					30524a6fbd
				
			@@ -20,7 +20,10 @@ async function run() {
 | 
				
			|||||||
        const primaryKey = core.getInput(Inputs.Key, { required: true });
 | 
					        const primaryKey = core.getInput(Inputs.Key, { required: true });
 | 
				
			||||||
        core.saveState(State.CacheKey, primaryKey);
 | 
					        core.saveState(State.CacheKey, primaryKey);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        const restoreKeys = core.getInput(Inputs.RestoreKeys).split("\n");
 | 
					        const restoreKeys = core
 | 
				
			||||||
 | 
					            .getInput(Inputs.RestoreKeys)
 | 
				
			||||||
 | 
					            .split("\n")
 | 
				
			||||||
 | 
					            .filter(x => x !== "");
 | 
				
			||||||
        const keys = [primaryKey, ...restoreKeys];
 | 
					        const keys = [primaryKey, ...restoreKeys];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        core.debug("Resolved Keys:");
 | 
					        core.debug("Resolved Keys:");
 | 
				
			||||||
@@ -52,7 +55,7 @@ async function run() {
 | 
				
			|||||||
            const cacheEntry = await cacheHttpClient.getCacheEntry(keys);
 | 
					            const cacheEntry = await cacheHttpClient.getCacheEntry(keys);
 | 
				
			||||||
            if (!cacheEntry) {
 | 
					            if (!cacheEntry) {
 | 
				
			||||||
                core.info(
 | 
					                core.info(
 | 
				
			||||||
                    `Cache not found for input keys: ${JSON.stringify(keys)}.`
 | 
					                    `Cache not found for input keys: ${keys.join(", ")}.`
 | 
				
			||||||
                );
 | 
					                );
 | 
				
			||||||
                return;
 | 
					                return;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user