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
+5 -7
View File
@@ -10,14 +10,12 @@ function getRuffVersionFromAllDependencies(
);
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;