mirror of
https://github.com/actions/setup-python.git
synced 2025-04-24 15:32:13 +00:00
fix: non-zero exit code for falsey version
This commit fixes an issue where an empty string input for the 'python-version' input parameter succeeds silently without installing any versions.
This commit is contained in:
parent
feeaa3ba49
commit
34cc07ddac
2 changed files with 27 additions and 25 deletions
7
dist/index.js
vendored
7
dist/index.js
vendored
|
@ -2651,8 +2651,10 @@ function isPyPyVersion(versionSpec) {
|
||||||
function run() {
|
function run() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
try {
|
try {
|
||||||
let version = core.getInput('python-version');
|
const version = core.getInput('python-version');
|
||||||
if (version) {
|
if (!version) {
|
||||||
|
throw new Error(`Invalid python version: ${version}`);
|
||||||
|
}
|
||||||
const arch = core.getInput('architecture') || os.arch();
|
const arch = core.getInput('architecture') || os.arch();
|
||||||
if (isPyPyVersion(version)) {
|
if (isPyPyVersion(version)) {
|
||||||
const installed = yield finderPyPy.findPyPyVersion(version, arch);
|
const installed = yield finderPyPy.findPyPyVersion(version, arch);
|
||||||
|
@ -2662,7 +2664,6 @@ function run() {
|
||||||
const installed = yield finder.findPythonVersion(version, arch);
|
const installed = yield finder.findPythonVersion(version, arch);
|
||||||
core.info(`Successfully setup ${installed.impl} (${installed.version})`);
|
core.info(`Successfully setup ${installed.impl} (${installed.version})`);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
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')}`);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,8 +10,10 @@ function isPyPyVersion(versionSpec: string) {
|
||||||
|
|
||||||
async function run() {
|
async function run() {
|
||||||
try {
|
try {
|
||||||
let version = core.getInput('python-version');
|
const version: string = core.getInput('python-version');
|
||||||
if (version) {
|
if (!version) {
|
||||||
|
throw new Error(`Invalid python version: ${version}`)
|
||||||
|
}
|
||||||
const arch: string = core.getInput('architecture') || os.arch();
|
const arch: string = core.getInput('architecture') || os.arch();
|
||||||
if (isPyPyVersion(version)) {
|
if (isPyPyVersion(version)) {
|
||||||
const installed = await finderPyPy.findPyPyVersion(version, arch);
|
const installed = await finderPyPy.findPyPyVersion(version, arch);
|
||||||
|
@ -24,7 +26,6 @@ async function run() {
|
||||||
`Successfully setup ${installed.impl} (${installed.version})`
|
`Successfully setup ${installed.impl} (${installed.version})`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
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')}`);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue