Skip to content

Commit 2f81f2c

Browse files
authored
Merge pull request #11 from codeflash-ai/fix/gha-installation
check for already installation of GHA
2 parents 4a15907 + 522ea97 commit 2f81f2c

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

codeflash/cli_cmds/cmd_init.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,19 @@ def install_github_actions() -> None:
372372
workflows_path = git_root / ".github" / "workflows"
373373
optimize_yaml_path = workflows_path / "codeflash.yaml"
374374

375+
# Check if the workflow file already exists
376+
if optimize_yaml_path.exists():
377+
confirm_overwrite = inquirer_wrapper(
378+
inquirer.confirm,
379+
message=f"⚡️ GitHub Actions workflow already exists at {optimize_yaml_path}. Overwrite?",
380+
default=False, # Don't overwrite by default
381+
)
382+
ph("cli-github-optimization-confirm-workflow-overwrite", {"confirm_overwrite": confirm_overwrite})
383+
if not confirm_overwrite:
384+
click.echo("⏩️ Skipping workflow creation.")
385+
ph("cli-github-workflow-skipped")
386+
return
387+
375388
confirm_creation_yes = inquirer_wrapper(
376389
inquirer.confirm,
377390
message="⚡️Shall I set up a GitHub action that will continuously optimize all new code in GitHub PRs"

0 commit comments

Comments
 (0)