mirror of
https://github.com/actions/setup-node.git
synced 2025-04-22 09:21:00 +00:00
syncing with main
This commit is contained in:
parent
36bb47b5a0
commit
34ece939a3
2 changed files with 18 additions and 16 deletions
26
dist/setup/index.js
vendored
26
dist/setup/index.js
vendored
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue