optimize code

This commit is contained in:
mahabaleshwars 2025-03-06 16:36:53 +05:30
parent e34c938f7b
commit d5a4d05a4b
2 changed files with 4 additions and 10 deletions

7
dist/setup/index.js vendored
View File

@ -100729,7 +100729,6 @@ function getVersionInputFromToolVersions(versionFile) {
try { try {
const fileContents = fs_1.default.readFileSync(versionFile, 'utf8'); const fileContents = fs_1.default.readFileSync(versionFile, 'utf8');
const lines = fileContents.split('\n'); const lines = fileContents.split('\n');
const versions = [];
for (const line of lines) { for (const line of lines) {
// Skip commented lines // Skip commented lines
if (line.trim().startsWith('#')) { if (line.trim().startsWith('#')) {
@ -100740,10 +100739,8 @@ function getVersionInputFromToolVersions(versionFile) {
return [((_a = match.groups) === null || _a === void 0 ? void 0 : _a.version.trim()) || '']; return [((_a = match.groups) === null || _a === void 0 ? void 0 : _a.version.trim()) || ''];
} }
} }
if (versions.length === 0) { core.warning(`No Python version found in ${versionFile}`);
core.warning(`No Python version found in ${versionFile}`); return [];
}
return versions;
} }
catch (error) { catch (error) {
core.error(`Error reading ${versionFile}: ${error.message}`); core.error(`Error reading ${versionFile}: ${error.message}`);

View File

@ -290,7 +290,6 @@ export function getVersionInputFromToolVersions(versionFile: string): string[] {
try { try {
const fileContents = fs.readFileSync(versionFile, 'utf8'); const fileContents = fs.readFileSync(versionFile, 'utf8');
const lines = fileContents.split('\n'); const lines = fileContents.split('\n');
const versions: string[] = [];
for (const line of lines) { for (const line of lines) {
// Skip commented lines // Skip commented lines
@ -303,11 +302,9 @@ export function getVersionInputFromToolVersions(versionFile: string): string[] {
} }
} }
if (versions.length === 0) { core.warning(`No Python version found in ${versionFile}`);
core.warning(`No Python version found in ${versionFile}`);
}
return versions; return [];
} catch (error) { } catch (error) {
core.error(`Error reading ${versionFile}: ${(error as Error).message}`); core.error(`Error reading ${versionFile}: ${(error as Error).message}`);
return []; return [];