GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix resolveVersionInput() logic · actions/setup-python@b88a682

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • dist/setup
    • index.js
  • src
    • setup-python.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎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() {
Collapse file

‎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)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.