mirror of
https://github.com/actions/setup-python.git
synced 2025-04-24 15:32:13 +00:00
Throwing an error when python-version input is empty and PYTHON_VERSION_REQUIRED is set true
This commit is contained in:
parent
6ed2c67c8a
commit
35853705fb
2 changed files with 19 additions and 4 deletions
7
dist/setup/index.js
vendored
7
dist/setup/index.js
vendored
|
@ -97729,8 +97729,15 @@ function run() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
const trueValue = ['true', 'True', 'TRUE'];
|
||||||
|
const pythonVersionRequired = process.env['PYTHON_VERSION_REQUIRED'] || '';
|
||||||
|
if (!trueValue.includes(pythonVersionRequired)) {
|
||||||
core.warning('The `python-version` input is not set. The version of Python currently in `PATH` will be used.');
|
core.warning('The `python-version` input is not set. The version of Python currently in `PATH` will be used.');
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
throw new Error(`The python-version input is required.`);
|
||||||
|
}
|
||||||
|
}
|
||||||
const matchersPath = path.join(__dirname, '../..', '.github');
|
const matchersPath = path.join(__dirname, '../..', '.github');
|
||||||
core.info(`##[add-matcher]${path.join(matchersPath, 'python.json')}`);
|
core.info(`##[add-matcher]${path.join(matchersPath, 'python.json')}`);
|
||||||
}
|
}
|
||||||
|
|
|
@ -146,9 +146,17 @@ async function run() {
|
||||||
await cacheDependencies(cache, pythonVersion);
|
await cacheDependencies(cache, pythonVersion);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
const trueValue = ['true', 'True', 'TRUE'];
|
||||||
|
const pythonVersionRequired = process.env['PYTHON_VERSION_REQUIRED'] || '';
|
||||||
|
if(!trueValue.includes(pythonVersionRequired)) {
|
||||||
core.warning(
|
core.warning(
|
||||||
'The `python-version` input is not set. The version of Python currently in `PATH` will be used.'
|
'The `python-version` input is not set. The version of Python currently in `PATH` will be used.'
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
throw new Error(
|
||||||
|
`The python-version input is required.`
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const matchersPath = path.join(__dirname, '../..', '.github');
|
const matchersPath = path.join(__dirname, '../..', '.github');
|
||||||
core.info(`##[add-matcher]${path.join(matchersPath, 'python.json')}`);
|
core.info(`##[add-matcher]${path.join(matchersPath, 'python.json')}`);
|
||||||
|
|
Loading…
Add table
Reference in a new issue