@@ -85,12 +85,16 @@ def init_codeflash() -> None:
8585
8686 did_add_new_key = prompt_api_key ()
8787
88- if should_modify_pyproject_toml ():
89- setup_info : SetupInfo = collect_setup_info ()
88+ should_modify , config = should_modify_pyproject_toml ()
89+
90+ git_remote = config .get ("git_remote" , "origin" ) if config else "origin"
9091
92+ if should_modify :
93+ setup_info : SetupInfo = collect_setup_info ()
94+ git_remote = setup_info .git_remote
9195 configure_pyproject_toml (setup_info )
9296
93- install_github_app ()
97+ install_github_app (git_remote )
9498
9599 install_github_actions (override_formatter_check = True )
96100
@@ -151,7 +155,7 @@ def ask_run_end_to_end_test(args: Namespace) -> None:
151155 run_end_to_end_test (args , bubble_sort_path , bubble_sort_test_path )
152156
153157
154- def should_modify_pyproject_toml () -> bool :
158+ def should_modify_pyproject_toml () -> tuple [ bool , dict [ str , Any ] | None ] :
155159 """Check if the current directory contains a valid pyproject.toml file with codeflash config.
156160
157161 If it does, ask the user if they want to re-configure it.
@@ -160,22 +164,22 @@ def should_modify_pyproject_toml() -> bool:
160164
161165 pyproject_toml_path = Path .cwd () / "pyproject.toml"
162166 if not pyproject_toml_path .exists ():
163- return True
167+ return True , None
164168 try :
165169 config , config_file_path = parse_config_file (pyproject_toml_path )
166170 except Exception :
167- return True
171+ return True , None
168172
169173 if "module_root" not in config or config ["module_root" ] is None or not Path (config ["module_root" ]).is_dir ():
170- return True
174+ return True , None
171175 if "tests_root" not in config or config ["tests_root" ] is None or not Path (config ["tests_root" ]).is_dir ():
172- return True
176+ return True , None
173177
174178 return Confirm .ask (
175179 "✅ A valid Codeflash config already exists in this project. Do you want to re-configure it?" ,
176180 default = False ,
177181 show_default = True ,
178- )
182+ ), config
179183
180184
181185# Custom theme for better UX
@@ -958,16 +962,18 @@ def configure_pyproject_toml(setup_info: SetupInfo) -> None:
958962 click .echo ()
959963
960964
961- def install_github_app () -> None :
965+ def install_github_app (git_remote : str ) -> None :
962966 try :
963967 git_repo = git .Repo (search_parent_directories = True )
964968 except git .InvalidGitRepositoryError :
965969 click .echo ("Skipping GitHub app installation because you're not in a git repository." )
966970 return
967- owner , repo = get_repo_owner_and_name (git_repo )
971+ owner , repo = get_repo_owner_and_name (git_repo , git_remote )
968972
969973 if is_github_app_installed_on_repo (owner , repo , suppress_errors = True ):
970- click .echo ("🐙 Looks like you've already installed the Codeflash GitHub app on this repository! Continuing…" )
974+ click .echo (
975+ f"🐙 Looks like you've already installed the Codeflash GitHub app on this repository ({ owner } /{ repo } )! Continuing…"
976+ )
971977
972978 else :
973979 click .prompt (
0 commit comments