From b74b8e018ae53df0c34553c28340aa4e9610e94b Mon Sep 17 00:00:00 2001 From: IvanZosimov Date: Wed, 28 Sep 2022 14:10:10 +0200 Subject: [PATCH] Refactor code --- dist/index.js | 7 +++---- src/setup-dotnet.ts | 10 ++++------ 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/dist/index.js b/dist/index.js index bf3e1cd..5a43f0c 100644 --- a/dist/index.js +++ b/dist/index.js @@ -484,12 +484,11 @@ function run() { auth.configAuthentication(sourceUrl, configFile); } const comparisonRange = globalJsonFileInput - ? versions.at(-1) + ? versions[versions.length - 1] : '*'; - const includePrereleaseOption = { + const versionToOutput = semver_1.default.maxSatisfying(installedDotnetVersions, comparisonRange, { includePrerelease: true - }; - const versionToOutput = semver_1.default.maxSatisfying(installedDotnetVersions, comparisonRange, includePrereleaseOption); + }); core.setOutput('dotnet-version', versionToOutput); const matchersPath = path_1.default.join(__dirname, '..', '.github'); core.info(`##[add-matcher]${path_1.default.join(matchersPath, 'csc.json')}`); diff --git a/src/setup-dotnet.ts b/src/setup-dotnet.ts index 5cdb880..ba2e419 100644 --- a/src/setup-dotnet.ts +++ b/src/setup-dotnet.ts @@ -75,17 +75,15 @@ export async function run() { } const comparisonRange: string = globalJsonFileInput - ? versions.at(-1)! + ? versions[versions.length - 1]! : '*'; - const includePrereleaseOption = { - includePrerelease: true - }; - const versionToOutput = semver.maxSatisfying( installedDotnetVersions, comparisonRange, - includePrereleaseOption + { + includePrerelease: true + } ); core.setOutput('dotnet-version', versionToOutput);