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