Skip to content

Commit 198595c

Browse files
authored
Merge pull request #204 from codeflash-ai/add-pr-url
Updated message that displays in terminal when codeflash creates a PR
2 parents 3f795db + 8e08592 commit 198595c

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

codeflash/code_utils/github_utils.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,6 @@ def require_github_app_or_exit(owner: str, repo: str) -> None:
2626
f"Note: if you want to find optimizations without opening PRs, you can run Codeflash with the --no-pr flag.{LF}"
2727
)
2828
apologize_and_exit()
29+
30+
def github_pr_url(owner: str, repo: str, pr_number: str) -> str:
31+
return f"https://github.com/{owner}/{repo}/pull/{pr_number}"

codeflash/result/create_pr.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
get_repo_owner_and_name,
1616
git_root_dir,
1717
)
18+
from codeflash.code_utils.github_utils import github_pr_url
1819
from codeflash.github.PrComment import FileDiffContent, PrComment
1920

2021
if TYPE_CHECKING:
@@ -132,7 +133,9 @@ def check_create_pr(
132133
coverage_message=coverage_message,
133134
)
134135
if response.ok:
135-
logger.info(f"Successfully created a new PR #{response.text} with the optimized code.")
136+
pr_id = response.text
137+
pr_url = github_pr_url(owner, repo, pr_id)
138+
logger.info(f"Successfully created a new PR #{pr_id} with the optimized code: {pr_url}")
136139
else:
137140
logger.error(
138141
f"Optimization was successful, but I failed to create a PR with the optimized code."

0 commit comments

Comments
 (0)