mirror of
https://code.forgejo.org/actions/setup-node.git
synced 2025-06-08 21:21:12 +00:00
minor changes and error fix
This commit is contained in:
parent
cc2914011d
commit
36c80a7556
4 changed files with 1401 additions and 224 deletions
18
src/main.ts
18
src/main.ts
|
@ -74,25 +74,25 @@ function isGhes(): boolean {
|
|||
}
|
||||
|
||||
function resolveVersionInput(): string {
|
||||
if (!(core.getInput('node-version') || core.getInput('version'))) {
|
||||
core.error('No specified file exists');
|
||||
}
|
||||
|
||||
if (core.getInput('node-version') && core.getInput('version')) {
|
||||
core.warning('Both version and node-version-file are specified');
|
||||
}
|
||||
|
||||
let version = core.getInput('node-version') || core.getInput('version');
|
||||
const versionFileInput = core.getInput('node-version-file');
|
||||
|
||||
if (version && versionFileInput) {
|
||||
core.warning('Both node-version and node-version-file are specified');
|
||||
}
|
||||
|
||||
if (version) {
|
||||
return version;
|
||||
}
|
||||
|
||||
const versionFileInput = core.getInput('node-version-file');
|
||||
if (versionFileInput) {
|
||||
const versionFilePath = path.join(
|
||||
process.env.GITHUB_WORKSPACE!,
|
||||
versionFileInput
|
||||
);
|
||||
if (!fs.existsSync(versionFilePath)) {
|
||||
throw new Error('No specified file exists');
|
||||
}
|
||||
version = installer.parseNodeVersionFile(
|
||||
fs.readFileSync(versionFilePath, 'utf8')
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue