mirror of
				https://gitea.com/actions/setup-node.git
				synced 2025-10-27 17:58:59 +08:00 
			
		
		
		
	feat(cache): add flag to only restore cache
This commit is contained in:
		| @@ -25,6 +25,9 @@ inputs: | |||||||
|     description: 'Used to specify a package manager for caching in the default directory. Supported values: npm, yarn, pnpm.' |     description: 'Used to specify a package manager for caching in the default directory. Supported values: npm, yarn, pnpm.' | ||||||
|   cache-dependency-path: |   cache-dependency-path: | ||||||
|     description: 'Used to specify the path to a dependency file: package-lock.json, yarn.lock, etc. Supports wildcards or a list of file names for caching multiple dependencies.' |     description: 'Used to specify the path to a dependency file: package-lock.json, yarn.lock, etc. Supports wildcards or a list of file names for caching multiple dependencies.' | ||||||
|  |   cache-restore-only: | ||||||
|  |     description: 'Set this option if you dont want to save the cache when it couldnt be restored.' | ||||||
|  |     default: false | ||||||
| # TODO: add input to control forcing to pull from cloud or dist. | # TODO: add input to control forcing to pull from cloud or dist. | ||||||
| #       escape valve for someone having issues or needing the absolute latest which isn't cached yet | #       escape valve for someone having issues or needing the absolute latest which isn't cached yet | ||||||
| outputs: | outputs: | ||||||
|   | |||||||
| @@ -33,6 +33,10 @@ const cachePackages = async (packageManager: string) => { | |||||||
|     core.debug(`Caching for '${packageManager}' is not supported`); |     core.debug(`Caching for '${packageManager}' is not supported`); | ||||||
|     return; |     return; | ||||||
|   } |   } | ||||||
|  |   if (core.getInput('cache-restore-only') == true ){ | ||||||
|  |     core.info(`Cache was not saved since 'cache-restore-only' was set }`); | ||||||
|  |     return; | ||||||
|  |   } | ||||||
|  |  | ||||||
|   if (!cachePaths.length) { |   if (!cachePaths.length) { | ||||||
|     // TODO: core.getInput has a bug - it can return undefined despite its definition (tests only?) |     // TODO: core.getInput has a bug - it can return undefined despite its definition (tests only?) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Ari Kishon
					Ari Kishon