GeezerVison is showing github.com — Fix resolveVersionInput() logic · actions/setup-python@b88a682
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: dist/setup/index.js +9-6Lines changed: 9 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -65262,17 +65262,20 @@ function resolveVersionInput() { |
65262 | 65262 | } |
65263 | 65263 | if (versionFile) { |
65264 | 65264 | 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.`); |
65270 | 65266 | } |
65271 | 65267 | version = fs_1.default.readFileSync(versionFile, 'utf8'); |
65272 | 65268 | core.info(`Resolved ${versionFile} as ${version}`); |
65273 | 65269 | return version; |
65274 | 65270 | } |
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.`); |
65276 | 65279 | return version; |
65277 | 65280 | } |
65278 | 65281 | function run() { |
|
Collapse file
Copy file name to clipboardExpand all lines: src/setup-python.ts +12-10Lines changed: 12 additions & 10 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -38,24 +38,26 @@ function resolveVersionInput(): string { |
38 | 38 |
|
39 | 39 | if (versionFile) { |
40 | 40 | 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.` |
43 | 43 | ); |
44 | | - versionFile = '.python-version'; |
45 | | - if (!fs.existsSync(versionFile)) { |
46 | | - throw new Error(`The ${versionFile} doesn't exist.`); |
47 | | - } |
48 | 44 | } |
49 | | - |
50 | 45 | version = fs.readFileSync(versionFile, 'utf8'); |
51 | 46 | core.info(`Resolved ${versionFile} as ${version}`); |
52 | | - |
53 | 47 | return version; |
54 | 48 | } |
55 | 49 |
|
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." |
58 | 52 | ); |
| 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.`); |
59 | 61 |
|
60 | 62 | return version; |
61 | 63 | } |
|