From 30685566242df5a71185c20184469a0a1a8f63c9 Mon Sep 17 00:00:00 2001 From: "sweep-nightly[bot]" <131841235+sweep-nightly[bot]@users.noreply.github.com> Date: Sat, 6 Apr 2024 00:21:53 +0000 Subject: [PATCH] feat: Updated 1 files --- sweepai/api.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/sweepai/api.py b/sweepai/api.py index cb3435a8e0..e8365e2aba 100644 --- a/sweepai/api.py +++ b/sweepai/api.py @@ -402,11 +402,14 @@ def update_sweep_prs_v2(repo_full_name: str, installation_id: int): pr.edit(state="closed") continue - repo.merge( - feature_branch, - pr.base.ref, - f"Merge main into {feature_branch}", - ) + try: + repo.rebase(pr.base.ref, feature_branch) + except github.GithubException as e: + if e.status == 409: # Merge conflict + pr.edit(state="closed") + continue + else: + raise # Check if the merged PR is the config PR if pr.title == "Configure Sweep" and pr.merged: @@ -414,7 +417,7 @@ def update_sweep_prs_v2(repo_full_name: str, installation_id: int): create_gha_pr(g, repo) except Exception as e: logger.warning( - f"Failed to merge changes from default branch into PR #{pr.number}: {e}" + f"Failed to rebase feature branch for PR #{pr.number}: {e}" ) except Exception: logger.warning("Failed to update sweep PRs")