Support hashes in requirement files for version-file (#287)

This commit is contained in:
Mattias L
2025-12-17 16:29:06 +01:00
committed by GitHub
parent 8b935c8722
commit e85c033ebc
4 changed files with 31 additions and 14 deletions
Generated Vendored
+4 -7
View File
@@ -32317,14 +32317,11 @@ const toml = __importStar(__nccwpck_require__(7106));
function getRuffVersionFromAllDependencies(allDependencies) {
const ruffVersionDefinition = allDependencies.find((dep) => dep.startsWith("ruff"));
if (ruffVersionDefinition) {
const ruffVersion = ruffVersionDefinition
.match(/^ruff([^A-Z0-9._-]+.*)$/)?.[1]
.trim();
if (ruffVersion?.startsWith("==")) {
return ruffVersion.slice(2);
const match = ruffVersionDefinition.trim().match(/^ruff\s*==\s*([^\s\\]+)/);
if (match) {
core.info(`Found ruff version in requirements file: ${match[1]}`);
return match[1];
}
core.info(`Found ruff version in pyproject.toml: ${ruffVersion}`);
return ruffVersion;
}
return undefined;
}