mirror of
https://github.com/actions/setup-python.git
synced 2025-04-24 15:32:13 +00:00
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:
parent
a23b52aaef
commit
b1d984909d
2 changed files with 6 additions and 7 deletions
5
dist/setup/index.js
vendored
5
dist/setup/index.js
vendored
|
@ -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`);
|
||||
}
|
||||
|
|
|
@ -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`
|
||||
|
|
Loading…
Add table
Reference in a new issue