mirror of
				https://github.com/actions/setup-java.git
				synced 2025-10-31 14:30:53 +00:00 
			
		
		
		
	Checked for the file extension
This commit is contained in:
		
					parent
					
						
							
								12fa539aa2
							
						
					
				
			
			
				commit
				
					
						3ac7f4d7ac
					
				
			
		
					 3 changed files with 12 additions and 3 deletions
				
			
		
							
								
								
									
										5
									
								
								dist/cleanup/index.js
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										5
									
								
								dist/cleanup/index.js
									
										
									
									
										vendored
									
									
								
							|  | @ -87893,9 +87893,12 @@ function getVersionFromFileContent(content, distributionName, versionFile) { | ||||||
|     if (versionFile == '.tool-versions') { |     if (versionFile == '.tool-versions') { | ||||||
|         javaVersionRegExp = /^java\s+(?:\S+-)?v?(?<version>[^\s]+)$/m; |         javaVersionRegExp = /^java\s+(?:\S+-)?v?(?<version>[^\s]+)$/m; | ||||||
|     } |     } | ||||||
|     else { |     else if (versionFile == '.java-version') { | ||||||
|         javaVersionRegExp = /(?<version>(?<=(^|\s|-))(\d+\S*))(\s|$)/; |         javaVersionRegExp = /(?<version>(?<=(^|\s|-))(\d+\S*))(\s|$)/; | ||||||
|     } |     } | ||||||
|  |     else { | ||||||
|  |         throw new Error('Invalid version file'); | ||||||
|  |     } | ||||||
|     const fileContent = ((_b = (_a = content.match(javaVersionRegExp)) === null || _a === void 0 ? void 0 : _a.groups) === null || _b === void 0 ? void 0 : _b.version) |     const fileContent = ((_b = (_a = content.match(javaVersionRegExp)) === null || _a === void 0 ? void 0 : _a.groups) === null || _b === void 0 ? void 0 : _b.version) | ||||||
|         ? (_d = (_c = content.match(javaVersionRegExp)) === null || _c === void 0 ? void 0 : _c.groups) === null || _d === void 0 ? void 0 : _d.version |         ? (_d = (_c = content.match(javaVersionRegExp)) === null || _c === void 0 ? void 0 : _c.groups) === null || _d === void 0 ? void 0 : _d.version | ||||||
|         : ''; |         : ''; | ||||||
|  |  | ||||||
							
								
								
									
										5
									
								
								dist/setup/index.js
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										5
									
								
								dist/setup/index.js
									
										
									
									
										vendored
									
									
								
							|  | @ -125267,9 +125267,12 @@ function getVersionFromFileContent(content, distributionName, versionFile) { | ||||||
|     if (versionFile == '.tool-versions') { |     if (versionFile == '.tool-versions') { | ||||||
|         javaVersionRegExp = /^java\s+(?:\S+-)?v?(?<version>[^\s]+)$/m; |         javaVersionRegExp = /^java\s+(?:\S+-)?v?(?<version>[^\s]+)$/m; | ||||||
|     } |     } | ||||||
|     else { |     else if (versionFile == '.java-version') { | ||||||
|         javaVersionRegExp = /(?<version>(?<=(^|\s|-))(\d+\S*))(\s|$)/; |         javaVersionRegExp = /(?<version>(?<=(^|\s|-))(\d+\S*))(\s|$)/; | ||||||
|     } |     } | ||||||
|  |     else { | ||||||
|  |         throw new Error('Invalid version file'); | ||||||
|  |     } | ||||||
|     const fileContent = ((_b = (_a = content.match(javaVersionRegExp)) === null || _a === void 0 ? void 0 : _a.groups) === null || _b === void 0 ? void 0 : _b.version) |     const fileContent = ((_b = (_a = content.match(javaVersionRegExp)) === null || _a === void 0 ? void 0 : _a.groups) === null || _b === void 0 ? void 0 : _b.version) | ||||||
|         ? (_d = (_c = content.match(javaVersionRegExp)) === null || _c === void 0 ? void 0 : _c.groups) === null || _d === void 0 ? void 0 : _d.version |         ? (_d = (_c = content.match(javaVersionRegExp)) === null || _c === void 0 ? void 0 : _c.groups) === null || _d === void 0 ? void 0 : _d.version | ||||||
|         : ''; |         : ''; | ||||||
|  |  | ||||||
|  | @ -8,6 +8,7 @@ import * as core from '@actions/core'; | ||||||
| import * as tc from '@actions/tool-cache'; | import * as tc from '@actions/tool-cache'; | ||||||
| import {INPUT_JOB_STATUS, DISTRIBUTIONS_ONLY_MAJOR_VERSION} from './constants'; | import {INPUT_JOB_STATUS, DISTRIBUTIONS_ONLY_MAJOR_VERSION} from './constants'; | ||||||
| import {OutgoingHttpHeaders} from 'http'; | import {OutgoingHttpHeaders} from 'http'; | ||||||
|  | import {error} from 'console'; | ||||||
| 
 | 
 | ||||||
| export function getTempDir() { | export function getTempDir() { | ||||||
|   const tempDirectory = process.env['RUNNER_TEMP'] || os.tmpdir(); |   const tempDirectory = process.env['RUNNER_TEMP'] || os.tmpdir(); | ||||||
|  | @ -121,8 +122,10 @@ export function getVersionFromFileContent( | ||||||
|   let javaVersionRegExp: RegExp; |   let javaVersionRegExp: RegExp; | ||||||
|   if (versionFile == '.tool-versions') { |   if (versionFile == '.tool-versions') { | ||||||
|     javaVersionRegExp = /^java\s+(?:\S+-)?v?(?<version>[^\s]+)$/m; |     javaVersionRegExp = /^java\s+(?:\S+-)?v?(?<version>[^\s]+)$/m; | ||||||
|   } else { |   } else if (versionFile == '.java-version') { | ||||||
|     javaVersionRegExp = /(?<version>(?<=(^|\s|-))(\d+\S*))(\s|$)/; |     javaVersionRegExp = /(?<version>(?<=(^|\s|-))(\d+\S*))(\s|$)/; | ||||||
|  |   } else { | ||||||
|  |     throw new Error('Invalid version file'); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   const fileContent = content.match(javaVersionRegExp)?.groups?.version |   const fileContent = content.match(javaVersionRegExp)?.groups?.version | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue