Correct log when python-version-file unspecified

Set the versionFile variable to its default value of .python-version
when it's not specified. This corrects the log statement to read:
"Resolved .python-version as x.y.z" rather than "Resolved  as x.y.z."
This commit is contained in:
Kurt von Laven 2022-06-10 16:03:48 -07:00 committed by Kurt von Laven
parent a23b52aaef
commit b1d984909d
No known key found for this signature in database
GPG key ID: 1CDDDF4A62B85F39
2 changed files with 6 additions and 7 deletions

5
dist/setup/index.js vendored
View file

@ -64546,14 +64546,15 @@ function cacheDependencies(cache, pythonVersion) {
}
function resolveVersionInput() {
let version = core.getInput('python-version');
const versionFile = core.getInput('python-version-file');
let 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');
versionFile = versionFile || '.python-version';
const versionFilePath = path.join(process.env.GITHUB_WORKSPACE, versionFile);
if (!fs_1.default.existsSync(versionFilePath)) {
throw new Error(`The specified python version file at: ${versionFilePath} does not exist`);
}

View file

@ -24,7 +24,7 @@ async function cacheDependencies(cache: string, pythonVersion: string) {
function resolveVersionInput(): string {
let version = core.getInput('python-version');
const versionFile = core.getInput('python-version-file');
let versionFile = core.getInput('python-version-file');
if (version && versionFile) {
core.warning(
@ -36,10 +36,8 @@ function resolveVersionInput(): string {
return version;
}
const versionFilePath = path.join(
process.env.GITHUB_WORKSPACE!,
versionFile || '.python-version'
);
versionFile = versionFile || '.python-version';
const versionFilePath = path.join(process.env.GITHUB_WORKSPACE!, versionFile);
if (!fs.existsSync(versionFilePath)) {
throw new Error(
`The specified python version file at: ${versionFilePath} does not exist`