File tree Expand file tree Collapse file tree 2 files changed +21
-16
lines changed Expand file tree Collapse file tree 2 files changed +21
-16
lines changed Original file line number Diff line number Diff 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}
6527865281function run() {
Original file line number Diff line number Diff 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}
You can’t perform that action at this time.
0 commit comments