Implemented support for repository defined node version files such as '.nvmrc'

This commit is contained in:
Taylor McCarthy 2020-11-01 17:04:22 -05:00
parent c6fd00ceb9
commit c3812bd36a
5 changed files with 83 additions and 0 deletions

9
dist/index.js vendored
View file

@ -4692,6 +4692,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
const core = __importStar(__webpack_require__(470));
const installer = __importStar(__webpack_require__(749));
const auth = __importStar(__webpack_require__(202));
const fs = __webpack_require__(747);
const path = __importStar(__webpack_require__(622));
const url_1 = __webpack_require__(835);
function run() {
@ -4705,6 +4706,14 @@ function run() {
if (!version) {
version = core.getInput('version');
}
if (!version) {
const versionFile = core.getInput('node-version-file');
if (!!versionFile) {
const versionFilePath = path.join(__dirname, '..', versionFile);
version = fs.readFileSync(versionFilePath, 'utf8');
core.info(`Resolved ${versionFile} as ${version}`);
}
}
if (version) {
let token = core.getInput('token');
let auth = !token || isGhes() ? undefined : `token ${token}`;