This commit is contained in:
Evgenii Korolevskii 2022-12-08 15:35:32 +01:00
parent a2ae8283cb
commit 10d2aa6bfd
2 changed files with 10 additions and 4 deletions

View File

@ -1,7 +1,12 @@
import fs from 'fs';
import * as core from '@actions/core';
import * as auth from './auth';
import { getBooleanInput, isCacheFeatureAvailable, getVersionFromFileContent, avoidOldNotation } from './util';
import {
getBooleanInput,
isCacheFeatureAvailable,
getVersionFromFileContent,
avoidOldNotation
} from './util';
import * as toolchains from './toolchains';
import * as constants from './constants';
import { restore } from './cache';
@ -120,4 +125,3 @@ interface installerInputsOptions {
jdkFile: string;
toolchainIds: Array<string>;
}

View File

@ -100,8 +100,10 @@ export function isCacheFeatureAvailable(): boolean {
return true;
}
export function getVersionFromFileContent(content: string, distributionName: string): string | null {
export function getVersionFromFileContent(
content: string,
distributionName: string
): string | null {
const javaVersionRegExp = /(?<version>(?<=(^|\s|\-))(\d+\S*))(\s|$)/;
const fileContent = content.match(javaVersionRegExp)?.groups?.version
? (content.match(javaVersionRegExp)?.groups?.version as string)