Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit aba6f4b

Browse filesBrowse files
Merge pull request actions#465 from IvanZosimov/pythonversionfile
Fixed resolveVersionInput() logic
2 parents c474c82 + b88a682 commit aba6f4b
Copy full SHA for aba6f4b

File tree

Expand file treeCollapse file tree

2 files changed

+21
-16
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+21
-16
lines changed

‎dist/setup/index.js

Copy file name to clipboardExpand all lines: dist/setup/index.js
+9-6Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65262,17 +65262,20 @@ function resolveVersionInput() {
6526265262
}
6526365263
if (versionFile) {
6526465264
if (!fs_1.default.existsSync(versionFile)) {
65265-
logWarning(`The specified python version file at: ${versionFile} doesn't exist. Attempting to find .python-version file.`);
65266-
versionFile = '.python-version';
65267-
if (!fs_1.default.existsSync(versionFile)) {
65268-
throw new Error(`The ${versionFile} doesn't exist.`);
65269-
}
65265+
throw new Error(`The specified python version file at: ${versionFile} doesn't exist.`);
6527065266
}
6527165267
version = fs_1.default.readFileSync(versionFile, 'utf8');
6527265268
core.info(`Resolved ${versionFile} as ${version}`);
6527365269
return version;
6527465270
}
65275-
core.warning("Neither 'python-version' nor 'python-version-file' inputs were supplied.");
65271+
logWarning("Neither 'python-version' nor 'python-version-file' inputs were supplied. Attempting to find '.python-version' file.");
65272+
versionFile = '.python-version';
65273+
if (fs_1.default.existsSync(versionFile)) {
65274+
version = fs_1.default.readFileSync(versionFile, 'utf8');
65275+
core.info(`Resolved ${versionFile} as ${version}`);
65276+
return version;
65277+
}
65278+
logWarning(`${versionFile} doesn't exist.`);
6527665279
return version;
6527765280
}
6527865281
function run() {

‎src/setup-python.ts

Copy file name to clipboardExpand all lines: src/setup-python.ts
+12-10Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,24 +38,26 @@ function resolveVersionInput(): string {
3838

3939
if (versionFile) {
4040
if (!fs.existsSync(versionFile)) {
41-
logWarning(
42-
`The specified python version file at: ${versionFile} doesn't exist. Attempting to find .python-version file.`
41+
throw new Error(
42+
`The specified python version file at: ${versionFile} doesn't exist.`
4343
);
44-
versionFile = '.python-version';
45-
if (!fs.existsSync(versionFile)) {
46-
throw new Error(`The ${versionFile} doesn't exist.`);
47-
}
4844
}
49-
5045
version = fs.readFileSync(versionFile, 'utf8');
5146
core.info(`Resolved ${versionFile} as ${version}`);
52-
5347
return version;
5448
}
5549

56-
core.warning(
57-
"Neither 'python-version' nor 'python-version-file' inputs were supplied."
50+
logWarning(
51+
"Neither 'python-version' nor 'python-version-file' inputs were supplied. Attempting to find '.python-version' file."
5852
);
53+
versionFile = '.python-version';
54+
if (fs.existsSync(versionFile)) {
55+
version = fs.readFileSync(versionFile, 'utf8');
56+
core.info(`Resolved ${versionFile} as ${version}`);
57+
return version;
58+
}
59+
60+
logWarning(`${versionFile} doesn't exist.`);
5961

6062
return version;
6163
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.