Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions codeflash/code_utils/github_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
5 changes: 4 additions & 1 deletion codeflash/result/create_pr.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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_number} with the optimized code: {pr_url}")
else:
logger.error(
f"Optimization was successful, but I failed to create a PR with the optimized code."
Expand Down
Loading