diff --git a/dist/setup/index.js b/dist/setup/index.js index a8ced7f5..e37bd774 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -6088,15 +6088,19 @@ function cacheDependencies(cache, pythonVersion) { } function resolveVersionInput() { let version = core.getInput('python-version'); - const versionFileInput = core.getInput('python-version-file'); - if (versionFileInput) { - const versionFilePath = path.join(process.env.GITHUB_WORKSPACE, versionFileInput); - if (!fs_1.default.existsSync(versionFilePath)) { - throw new Error(`The specified node version file at: ${versionFilePath} does not exist`); - } - version = fs_1.default.readFileSync(versionFilePath, 'utf8'); - core.info(`Resolved ${versionFileInput} as ${version}`); + const versionFile = core.getInput('python-version-file'); + if (version && versionFile) { + core.warning('Both python-version and python-version-file inputs are specified, only python-version will be used'); } + if (version) { + return version; + } + const versionFilePath = path.join(process.env.GITHUB_WORKSPACE, versionFile || ".python-version"); + if (!fs_1.default.existsSync(versionFilePath)) { + throw new Error(`The specified python version file at: ${versionFilePath} does not exist`); + } + version = fs_1.default.readFileSync(versionFilePath, 'utf8'); + core.info(`Resolved ${versionFile} as ${version}`); return version; } function run() {