diff --git a/src/main.ts b/src/main.ts index 3c5661b55..f4ad14418 100644 --- a/src/main.ts +++ b/src/main.ts @@ -72,6 +72,18 @@ function resolveVersionInput(): string { 'Both node-version and node-version-file inputs are specified, only node-version will be used' ); } + + if (version === "package") { + const packageJson = JSON.parse( + fs.readFileSync( + path.join( + process.env.GITHUB_WORKSPACE!, + "package.json" + ) + ) + ); + return packageJson.engines.node; + } if (version) { return version;