Fallback if toml file parsing failed (#246)

This commit is contained in:
Kevin Stillhammer 2025-01-16 16:54:33 +01:00 committed by GitHub
parent b5f58b2abc
commit 14dc0be27c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 45 additions and 2 deletions

View file

@ -9,7 +9,14 @@ export function getUvVersionFromConfigFile(
core.warning(`Could not find file: ${filePath}`);
return undefined;
}
let requiredVersion = getRequiredVersion(filePath);
let requiredVersion: string | undefined;
try {
requiredVersion = getRequiredVersion(filePath);
} catch (err) {
const message = (err as Error).message;
core.warning(`Error while parsing ${filePath}: ${message}`);
return undefined;
}
if (requiredVersion?.startsWith("==")) {
requiredVersion = requiredVersion.slice(2);