diff --git a/createreadmes.py b/createreadmes.py index 2c7115a..712e8ca 100644 --- a/createreadmes.py +++ b/createreadmes.py @@ -219,6 +219,7 @@ class Artifact(TypedDict): file: str lines: NotRequired[list[int]] repository: NotRequired[str] + branch: NotRequired[str] RuleStatus = Literal["disregarded", "observed", "not applicable", "unknown"] @@ -258,6 +259,8 @@ properties: type: string repository: type: string + branch: + type: string lines: type: array items: @@ -311,7 +314,9 @@ rule_names = { def artifact_to_string(info: ModelInformation, artifact: Artifact): file = Path(artifact['file']) filename = file.name - file_url = f"https://github.com/{artifact.get('repository', info['slug'])}/blob/{info.get('branch', 'master')}/{artifact['file']}" + project_branch = info.get("branch", "master") + branch = artifact.get("branch", project_branch) + file_url = f"https://github.com/{artifact.get('repository', info['slug'])}/blob/{branch}/{artifact['file']}" lines = artifact.get("lines") if lines is None: return f"- {filename}: [File]({file_url})" diff --git a/security_rules_schema.json b/security_rules_schema.json index 98bafe9..c68990d 100644 --- a/security_rules_schema.json +++ b/security_rules_schema.json @@ -28,6 +28,7 @@ "additionalProperties": false, "properties": { "repository": { "type": "string" }, + "branch": { "type": "string" }, "file": { "type": "string" }, "lines": { "type": "array", "items": { "type": "integer" } } },