Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: non-zero exit code for falsey version #262

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 12 additions & 11 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2651,17 +2651,18 @@ function isPyPyVersion(versionSpec) {
function run() {
return __awaiter(this, void 0, void 0, function* () {
try {
let version = core.getInput('python-version');
if (version) {
const arch = core.getInput('architecture') || os.arch();
if (isPyPyVersion(version)) {
const installed = yield finderPyPy.findPyPyVersion(version, arch);
core.info(`Successfully setup PyPy ${installed.resolvedPyPyVersion} with Python (${installed.resolvedPythonVersion})`);
}
else {
const installed = yield finder.findPythonVersion(version, arch);
core.info(`Successfully setup ${installed.impl} (${installed.version})`);
}
const version = core.getInput('python-version');
if (!version) {
throw new Error(`Invalid python version: ${version}`);
}
const arch = core.getInput('architecture') || os.arch();
if (isPyPyVersion(version)) {
const installed = yield finderPyPy.findPyPyVersion(version, arch);
core.info(`Successfully setup PyPy ${installed.resolvedPyPyVersion} with Python (${installed.resolvedPythonVersion})`);
}
else {
const installed = yield finder.findPythonVersion(version, arch);
core.info(`Successfully setup ${installed.impl} (${installed.version})`);
}
const matchersPath = path.join(__dirname, '..', '.github');
core.info(`##[add-matcher]${path.join(matchersPath, 'python.json')}`);
Expand Down
29 changes: 15 additions & 14 deletions src/setup-python.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,21 @@ function isPyPyVersion(versionSpec: string) {

async function run() {
try {
let version = core.getInput('python-version');
if (version) {
const arch: string = core.getInput('architecture') || os.arch();
if (isPyPyVersion(version)) {
const installed = await finderPyPy.findPyPyVersion(version, arch);
core.info(
`Successfully setup PyPy ${installed.resolvedPyPyVersion} with Python (${installed.resolvedPythonVersion})`
);
} else {
const installed = await finder.findPythonVersion(version, arch);
core.info(
`Successfully setup ${installed.impl} (${installed.version})`
);
}
const version: string = core.getInput('python-version');
if (!version) {
throw new Error(`Invalid python version: ${version}`)
}
const arch: string = core.getInput('architecture') || os.arch();
if (isPyPyVersion(version)) {
const installed = await finderPyPy.findPyPyVersion(version, arch);
core.info(
`Successfully setup PyPy ${installed.resolvedPyPyVersion} with Python (${installed.resolvedPythonVersion})`
);
} else {
const installed = await finder.findPythonVersion(version, arch);
core.info(
`Successfully setup ${installed.impl} (${installed.version})`
);
}
const matchersPath = path.join(__dirname, '..', '.github');
core.info(`##[add-matcher]${path.join(matchersPath, 'python.json')}`);
Expand Down