Skip to content

Commit 08a3fd6

Browse files
authored
Revert "fix(backend): Improve GitHub PR URL validation and API URL generation" (#10890)
Reverts #10317 The changes omit the hostname from the "prepared" URL, breaking some GitHub blocks.
1 parent 2df0e2b commit 08a3fd6

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

autogpt_platform/backend/backend/blocks/github/pull_requests.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -553,12 +553,11 @@ async def run(
553553

554554

555555
def prepare_pr_api_url(pr_url: str, path: str) -> str:
556-
pattern = r"^(?:https?://)?github\.com/([^/]+/[^/]+)/pull/(\d+)"
556+
# Pattern to capture the base repository URL and the pull request number
557+
pattern = r"^(?:https?://)?([^/]+/[^/]+/[^/]+)/pull/(\d+)"
557558
match = re.match(pattern, pr_url)
558559
if not match:
559-
raise ValueError(
560-
f"Invalid GitHub PR URL: {pr_url}. URL must be a valid pull request URL, e.g., https://github.com/owner/repo/pull/123"
561-
)
560+
return pr_url
562561

563-
repo_path, pr_number = match.groups()
564-
return f"{repo_path}/pulls/{pr_number}/{path}"
562+
base_url, pr_number = match.groups()
563+
return f"{base_url}/pulls/{pr_number}/{path}"

0 commit comments

Comments
 (0)