8000 Rearranged logic of the ResolveVersionInput() by IvanZosimov · Pull Request #450 · actions/setup-python · GitHub
[go: up one dir, main page]

Skip to content

Rearranged logic of the ResolveVersionInput() #450

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

Merged
merged 11 commits into from
Jul 4, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Rebuild action with new changes
  • Loading branch information
IvanZosimov committed Jun 30, 2022
commit a6b01c4e407b1f7787010fb1e61a07c065555209
24 changes: 12 additions & 12 deletions dist/setup/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -65270,19 +65270,19 @@ function resolveVersionInput() {
}
if (versionFile) {
const defaultVersionFile = '.python-version';
const VersionFileExists = fs_1.default.existsSync(versionFile);
const defaultVersionFileExists = fs_1.default.existsSync(defaultVersionFile);
if (!VersionFileExists && !defaultVersionFileExists) {
throw new Error(`The specified python version file at: ${versionFile} does not exist and default ${defaultVersionFile} file isn't found`);
}
if (VersionFileExists) {
version = fs_1.default.readFileSync(versionFile, 'utf8');
core.info(`Resolved ${versionFile} as ${version}`);
}
else {
version = fs_1.default.readFileSync(defaultVersionFile, 'utf8');
core.info(`Resolved ${defaultVersionFile} as ${version}`);
if (!fs_1.default.existsSync(versionFile)) {
if (versionFile === defaultVersionFile) {
throw new Error(`The specified python version file at: ${versionFile} does not exist.`);
}
if (fs_1.default.existsSync(defaultVersionFile)) {
versionFile = defaultVersionFile;
}
else {
throw new Error(`The specified python version file at: ${versionFile} does not exist and default ${defaultVersionFile} file isn't found`);
}
}
version = fs_1.default.readFileSync(versionFile, 'utf8');
core.info(`Resolved ${versionFile} as ${version}`);
return version;
}
core.warning("Neither 'python-version' nor 'python-version-file' inputs were supplied. ");
Expand Down
0