Fix node-version-file interprets entire package.json as a version (#865)

This commit is contained in:
NullVoxPopuli 2023-12-14 07:53:26 -05:00 committed by GitHub
parent 7247617371
commit b39b52d121
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 78 additions and 11 deletions

View file

@ -105,7 +105,17 @@ function resolveVersionInput(): string {
);
}
version = parseNodeVersionFile(fs.readFileSync(versionFilePath, 'utf8'));
const parsedVersion = parseNodeVersionFile(
fs.readFileSync(versionFilePath, 'utf8')
);
if (parsedVersion) {
version = parsedVersion;
} else {
core.warning(
`Could not determine node version from ${versionFilePath}. Falling back`
);
}
core.info(`Resolved ${versionFileInput} as ${version}`);
}