mirror of
https://github.com/astral-sh/ruff-action.git
synced 2026-05-12 20:50:14 +02:00
Support hashes in requirement files for version-file (#287)
This commit is contained in:
+4
-7
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user