Refactored code and removed redundant logic

This commit is contained in:
La'Kaleigh Harris 2021-10-01 19:16:00 +00:00 committed by GitHub
parent bca281829f
commit 82441b3f82
4 changed files with 50 additions and 89 deletions

View file

@ -5,7 +5,6 @@ import fs = require('fs');
import * as path from 'path';
import {restoreCache} from './cache-restore';
import {URL} from 'url';
import {parseNodeVersionFile} from './node-version-file';
import os = require('os');
export async function run() {
@ -24,12 +23,13 @@ export async function run() {
if (!!versionFile) {
const versionFilePath = path.join(__dirname, '..', versionFile);
version = await parseNodeVersionFile(
version = await installer.parseNodeVersionFile(
fs.readFileSync(versionFilePath, 'utf8')
);
core.info(`Resolved ${versionFile} as ${version}`);
}
}
let arch = core.getInput('architecture');
const cache = core.getInput('cache');
@ -87,3 +87,4 @@ function isGhes(): boolean {
);
return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM';
}