1
0
Fork 0
mirror of https://code.forgejo.org/actions/setup-python synced 2025-03-14 22:26:58 +01:00

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 {
const fileContents = fs_1.default.readFileSync(versionFile, 'utf8');
const lines = fileContents.split('\n');
const versions = [];
for (const line of lines) {
// Skip commented lines
if (line.trim().startsWith('#')) {
@ -100740,10 +100739,8 @@ function getVersionInputFromToolVersions(versionFile) {
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}`);
}
return versions;
core.warning(`No Python version found in ${versionFile}`);
return [];
}
catch (error) {
core.error(`Error reading ${versionFile}: ${error.message}`);

View file

@ -290,7 +290,6 @@ export function getVersionInputFromToolVersions(versionFile: string): string[] {
try {
const fileContents = fs.readFileSync(versionFile, 'utf8');
const lines = fileContents.split('\n');
const versions: string[] = [];
for (const line of 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) {
core.error(`Error reading ${versionFile}: ${(error as Error).message}`);
return [];