Added branch override for artifacts
This commit is contained in:
parent
62c96fcbf6
commit
44bae3fa85
@ -219,6 +219,7 @@ class Artifact(TypedDict):
|
|||||||
file: str
|
file: str
|
||||||
lines: NotRequired[list[int]]
|
lines: NotRequired[list[int]]
|
||||||
repository: NotRequired[str]
|
repository: NotRequired[str]
|
||||||
|
branch: NotRequired[str]
|
||||||
|
|
||||||
RuleStatus = Literal["disregarded", "observed", "not applicable", "unknown"]
|
RuleStatus = Literal["disregarded", "observed", "not applicable", "unknown"]
|
||||||
|
|
||||||
@ -258,6 +259,8 @@ properties:
|
|||||||
type: string
|
type: string
|
||||||
repository:
|
repository:
|
||||||
type: string
|
type: string
|
||||||
|
branch:
|
||||||
|
type: string
|
||||||
lines:
|
lines:
|
||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
@ -311,7 +314,9 @@ rule_names = {
|
|||||||
def artifact_to_string(info: ModelInformation, artifact: Artifact):
|
def artifact_to_string(info: ModelInformation, artifact: Artifact):
|
||||||
file = Path(artifact['file'])
|
file = Path(artifact['file'])
|
||||||
filename = file.name
|
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")
|
lines = artifact.get("lines")
|
||||||
if lines is None:
|
if lines is None:
|
||||||
return f"- {filename}: [File]({file_url})"
|
return f"- {filename}: [File]({file_url})"
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
"properties": {
|
"properties": {
|
||||||
"repository": { "type": "string" },
|
"repository": { "type": "string" },
|
||||||
|
"branch": { "type": "string" },
|
||||||
"file": { "type": "string" },
|
"file": { "type": "string" },
|
||||||
"lines": { "type": "array", "items": { "type": "integer" } }
|
"lines": { "type": "array", "items": { "type": "integer" } }
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user