From 34ece939a35f9a3ef7e4bac94d000565f500ed1b Mon Sep 17 00:00:00 2001 From: Hargun Kaur <56452820+hkaur008@users.noreply.github.com> Date: Tue, 26 Oct 2021 15:39:16 +0000 Subject: [PATCH] syncing with main --- dist/setup/index.js | 26 ++++++++++++++------------ src/main.ts | 8 ++++---- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index 60a3ec6a..217938cd 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -6868,18 +6868,7 @@ function run() { // Version is optional. If supplied, install / use from the tool cache // If not supplied then task is still used to setup proxy, auth, etc... // - let version = core.getInput('node-version'); - if (!version) { - version = core.getInput('version'); - if (!version) { - const versionFile = core.getInput('node-version-file'); - if (!!versionFile) { - const versionFilePath = path.join(process.env.GITHUB_WORKSPACE, versionFile); - version = installer.parseNodeVersionFile(fs_1.default.readFileSync(versionFilePath, 'utf8')); - core.info(`Resolved ${versionFile} as ${version}`); - } - } - } + let version = resolveVersionInput(); let arch = core.getInput('architecture'); const cache = core.getInput('cache'); // if architecture supplied but node-version is not @@ -6924,6 +6913,19 @@ function isGhes() { const ghUrl = new url_1.URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com'); return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM'; } +function resolveVersionInput() { + let version = core.getInput('node-version') || core.getInput('version'); + if (version) { + return version; + } + const versionFileInput = core.getInput('node-version-file'); + if (versionFileInput) { + const versionFilePath = path.join(process.env.GITHUB_WORKSPACE, versionFileInput); + version = installer.parseNodeVersionFile(fs_1.default.readFileSync(versionFilePath, 'utf8')); + core.info(`Resolved ${versionFileInput} as ${version}`); + } + return version; +} /***/ }), diff --git a/src/main.ts b/src/main.ts index 16b0f269..e912e2f9 100644 --- a/src/main.ts +++ b/src/main.ts @@ -82,14 +82,14 @@ function resolveVersionInput(): string { const versionFileInput = core.getInput('node-version-file'); if (versionFileInput) { const versionFilePath = path.join( - process.env.GITHUB_WORKSPACE!, - versionFileInput + process.env.GITHUB_WORKSPACE!, + versionFileInput ); version = installer.parseNodeVersionFile( - fs.readFileSync(versionFilePath, 'utf8') + fs.readFileSync(versionFilePath, 'utf8') ); core.info(`Resolved ${versionFileInput} as ${version}`); } return version; -} \ No newline at end of file +}