Do not push branch if the aider invocation fails #28
|
@ -211,9 +211,9 @@ def has_commits_on_branch(cwd: Path, base_branch: str, current_branch: str) -> b
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def run_cmd(cmd: list[str], cwd: Path | None = None, check=True) -> None:
|
def run_cmd(cmd: list[str], cwd: Path | None = None, check=True) -> subprocess.CompletedProcess:
|
||||||
print(cmd)
|
print(cmd)
|
||||||
subprocess.run(cmd, check=check, cwd=cwd)
|
return subprocess.run(cmd, check=check, cwd=cwd)
|
||||||
|
|
||||||
|
|
||||||
def solve_issue_in_repository(
|
def solve_issue_in_repository(
|
||||||
|
@ -236,7 +236,14 @@ def solve_issue_in_repository(
|
||||||
run_cmd(['git', 'checkout', '-b', branch_name], tmpdirname)
|
run_cmd(['git', 'checkout', '-b', branch_name], tmpdirname)
|
||||||
|
|
||||||
# Run aider
|
# Run aider
|
||||||
run_cmd(create_aider_command(f'# {issue_title}\n{issue_description}'), tmpdirname)
|
try:
|
||||||
|
aider_result = run_cmd(create_aider_command(f'# {issue_title}\n{issue_description}'), tmpdirname)
|
||||||
|
if aider_result.returncode != 0:
|
||||||
|
logger.error(f"Aider invocation failed for issue #{issue_number}")
|
||||||
|
return False
|
||||||
|
except subprocess.CalledProcessError:
|
||||||
|
logger.exception(f"Aider invocation failed with an exception for issue #{issue_number}")
|
||||||
|
return False
|
||||||
|
|
||||||
# Auto-fix standard code quality stuff
|
# Auto-fix standard code quality stuff
|
||||||
run_cmd(['bash', '-c', RUFF_FORMAT_AND_AUTO_FIX], tmpdirname, check=False)
|
run_cmd(['bash', '-c', RUFF_FORMAT_AND_AUTO_FIX], tmpdirname, check=False)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user