From 44e02a2d3c4faea73c489c97cec54dd9d6a6fb5f Mon Sep 17 00:00:00 2001 From: codegen-bot Date: Tue, 18 Mar 2025 20:30:28 +0000 Subject: [PATCH 1/2] Add PR URL and repository name to GithubViewPRTool response --- .../extensions/tools/github/view_pr.py | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/codegen/extensions/tools/github/view_pr.py b/src/codegen/extensions/tools/github/view_pr.py index 00c20f7bb..987cdc6b5 100644 --- a/src/codegen/extensions/tools/github/view_pr.py +++ b/src/codegen/extensions/tools/github/view_pr.py @@ -24,8 +24,16 @@ class ViewPRObservation(Observation): modified_symbols: list[str] = Field( description="Names of modified symbols in the PR", ) + pr_url: str = Field( + description="URL of the PR", + default="", + ) + repo_name: str = Field( + description="Name of the repository the PR belongs to", + default="", + ) - str_template: ClassVar[str] = "PR #{pr_id}" + str_template: ClassVar[str] = "PR #{pr_id} in {repo_name}: {pr_url}" def view_pr(codebase: Codebase, pr_id: int) -> ViewPRObservation: @@ -37,6 +45,11 @@ def view_pr(codebase: Codebase, pr_id: int) -> ViewPRObservation: """ try: patch, file_commit_sha, moddified_symbols = codebase.get_modified_symbols_in_pr(pr_id) + + # Get the PR object to extract URL and repo name + pr = codebase._op.get_pull_request(pr_id) + pr_url = pr.html_url if pr else "" + repo_name = codebase._op.repo_config.full_name if codebase._op.repo_config.full_name else "" return ViewPRObservation( status="success", @@ -44,6 +57,8 @@ def view_pr(codebase: Codebase, pr_id: int) -> ViewPRObservation: patch=patch, file_commit_sha=file_commit_sha, modified_symbols=moddified_symbols, + pr_url=pr_url, + repo_name=repo_name, ) except Exception as e: @@ -54,4 +69,6 @@ def view_pr(codebase: Codebase, pr_id: int) -> ViewPRObservation: patch="", file_commit_sha={}, modified_symbols=[], - ) + pr_url="", + repo_name="", + ) \ No newline at end of file From d0684318f8c94f9e685568abdbf8cd56397d0977 Mon Sep 17 00:00:00 2001 From: "codegen-sh[bot]" <131295404+codegen-sh[bot]@users.noreply.github.com> Date: Tue, 18 Mar 2025 20:31:20 +0000 Subject: [PATCH 2/2] Automated pre-commit update --- src/codegen/extensions/tools/github/view_pr.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/codegen/extensions/tools/github/view_pr.py b/src/codegen/extensions/tools/github/view_pr.py index 987cdc6b5..445f5e989 100644 --- a/src/codegen/extensions/tools/github/view_pr.py +++ b/src/codegen/extensions/tools/github/view_pr.py @@ -45,7 +45,7 @@ def view_pr(codebase: Codebase, pr_id: int) -> ViewPRObservation: """ try: patch, file_commit_sha, moddified_symbols = codebase.get_modified_symbols_in_pr(pr_id) - + # Get the PR object to extract URL and repo name pr = codebase._op.get_pull_request(pr_id) pr_url = pr.html_url if pr else "" @@ -71,4 +71,4 @@ def view_pr(codebase: Codebase, pr_id: int) -> ViewPRObservation: modified_symbols=[], pr_url="", repo_name="", - ) \ No newline at end of file + )