1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-10-31 19:42:16 +01:00

Dump referenced PRs to metadata/referenced-pull-requests.json

This commit is contained in:
Andrii Nikitin
2025-08-04 14:12:05 +02:00
committed by Daniel Mach
parent 7ff0cdc6b4
commit a208031331
2 changed files with 60 additions and 6 deletions

View File

@@ -86,6 +86,9 @@ class PullRequest(GiteaModel):
Split <owner>/<repo>#<number> or <owner>/<repo>!<number> into individual components and return them in a tuple.
"""
match = re.match(r"^([^/]+)/([^/]+)[#!]([0-9]+)$", pr_id)
if not match:
match = re.match(r"^([^/]+)/([^/]+)/pulls/([0-9]+)$", pr_id)
if not match:
raise ValueError(f"Invalid pull request id: {pr_id}")
return match.group(1), match.group(2), int(match.group(3))
@@ -265,6 +268,12 @@ class PullRequest(GiteaModel):
return str(table)
def to_light_dict(self, exclude_columns: Optional[list] = None):
x = ["allow_maintainer_edit", "body"]
if exclude_columns:
x += exclude_columns
return self.dict(x)
def dict(self, exclude_columns: Optional[list] = None):
import inspect