diff --git a/codeflash/code_utils/github_utils.py b/codeflash/code_utils/github_utils.py index fcabd9823..2b053a326 100644 --- a/codeflash/code_utils/github_utils.py +++ b/codeflash/code_utils/github_utils.py @@ -26,3 +26,6 @@ def require_github_app_or_exit(owner: str, repo: str) -> None: f"Note: if you want to find optimizations without opening PRs, you can run Codeflash with the --no-pr flag.{LF}" ) apologize_and_exit() + +def github_pr_url(owner: str, repo: str, pr_number: str) -> str: + return f"https://github.com/{owner}/{repo}/pull/{pr_number}" diff --git a/codeflash/result/create_pr.py b/codeflash/result/create_pr.py index da0c61961..502c811eb 100644 --- a/codeflash/result/create_pr.py +++ b/codeflash/result/create_pr.py @@ -15,6 +15,7 @@ get_repo_owner_and_name, git_root_dir, ) +from codeflash.code_utils.github_utils import github_pr_url from codeflash.github.PrComment import FileDiffContent, PrComment if TYPE_CHECKING: @@ -132,7 +133,9 @@ def check_create_pr( coverage_message=coverage_message, ) if response.ok: - logger.info(f"Successfully created a new PR #{response.text} with the optimized code.") + pr_id = response.text + pr_url = github_pr_url(owner, repo, pr_id) + logger.info(f"Successfully created a new PR #{pr_id} with the optimized code: {pr_url}") else: logger.error( f"Optimization was successful, but I failed to create a PR with the optimized code."