From b1d984909d57f1add73147ff5e35de027be683f1 Mon Sep 17 00:00:00 2001 From: Kurt von Laven Date: Fri, 10 Jun 2022 16:03:48 -0700 Subject: [PATCH] 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." --- dist/setup/index.js | 5 +++-- src/setup-python.ts | 8 +++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index 0d98b66f..32c80098 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -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`); } diff --git a/src/setup-python.ts b/src/setup-python.ts index f5f8c919..8e658706 100644 --- a/src/setup-python.ts +++ b/src/setup-python.ts @@ -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`