mirror of
				https://github.com/actions/setup-node.git
				synced 2025-10-31 16:14:00 +08:00 
			
		
		
		
	improve latest version syntax
This commit is contained in:
		| @@ -66,6 +66,11 @@ export async function getNode( | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   if (['current', 'latest', 'node'].includes(versionSpec)) { | ||||
|     versionSpec = await queryDistForMatch(versionSpec, arch); | ||||
|     core.info(`getting latest node version...`); | ||||
|   } | ||||
|  | ||||
|   // check cache | ||||
|   let toolPath: string; | ||||
|   toolPath = tc.find('node', versionSpec, osArch); | ||||
| @@ -373,15 +378,6 @@ async function queryDistForMatch( | ||||
|   let versions: string[] = []; | ||||
|   let nodeVersions = await getVersionsFromDist(); | ||||
|  | ||||
|   if ( | ||||
|     versionSpec === 'current' || | ||||
|     versionSpec === 'latest' || | ||||
|     versionSpec === 'node' | ||||
|   ) { | ||||
|     core.info(`getting latest node version...`); | ||||
|     return nodeVersions[0].version; | ||||
|   } | ||||
|  | ||||
|   nodeVersions.forEach((nodeVersion: INodeVersion) => { | ||||
|     // ensure this version supports your os and platform | ||||
|     if (nodeVersion.files.indexOf(dataFileName) >= 0) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 panticmilos
					panticmilos