[llvm] Remove fork handling from release issue workflow (PR #79310)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 24 07:44:35 PST 2024


https://github.com/nikic created https://github.com/llvm/llvm-project/pull/79310

This is currently broken, because the check is performed on the wrong repository. repo here is llvm/llvm-project, which is not a fork (so this will always trigger), then we'll push a new branch to llvmbot/llvm-project, and then again set the wrong owner, so we'll look for the branch in llvm/llvm-project rather than llvmbot/llvm-project.

Rather than fixing this, I'm removing the code entirely, as it shouldn't be needed anymore (llvmbot/llvm-project is a fork of llvm/llvm-project).

This will hopefully fix the failure from https://github.com/llvm/llvm-project/issues/79253#issuecomment-1908353688.

>From 2dc670858799e00d3b66e290175a8b90f7d479dc Mon Sep 17 00:00:00 2001
From: Nikita Popov <npopov at redhat.com>
Date: Wed, 24 Jan 2024 16:41:19 +0100
Subject: [PATCH] Remove fork handling from release issue workflow

This is currently broken, because the check is performed on the
wrong repository. repo here is llvm/llvm-project, which is not
a fork (so this will always trigger), then we'll push a new branch
to llvmbot/llvm-project, and then again set the wrong owner, so
we'll look for the branch in llvm/llvm-project.

Rather than fixing this, I'm removing the code entirely, as it
shouldn't be needed anymore (llvmbot/llvm-project is a fork of
llvm/llvm-project).
---
 llvm/utils/git/github-automation.py | 29 ++---------------------------
 1 file changed, 2 insertions(+), 27 deletions(-)

diff --git a/llvm/utils/git/github-automation.py b/llvm/utils/git/github-automation.py
index ffe4e54484fd53b..72db9995b0e8a59 100755
--- a/llvm/utils/git/github-automation.py
+++ b/llvm/utils/git/github-automation.py
@@ -498,33 +498,8 @@ def create_pull_request(self, owner: str, repo_name: str, branch: str) -> bool:
         release_branch_for_issue = self.release_branch_for_issue
         if release_branch_for_issue is None:
             return False
-        head_branch = branch
-        if not repo.fork:
-            # If the target repo is not a fork of llvm-project, we need to copy
-            # the branch into the target repo.  GitHub only supports cross-repo pull
-            # requests on forked repos.
-            head_branch = f"{owner}-{branch}"
-            local_repo = Repo(self.llvm_project_dir)
-            push_done = False
-            for _ in range(0, 5):
-                try:
-                    local_repo.git.fetch(
-                        f"https://github.com/{owner}/{repo_name}", f"{branch}:{branch}"
-                    )
-                    local_repo.git.push(
-                        self.push_url, f"{branch}:{head_branch}", force=True
-                    )
-                    push_done = True
-                    break
-                except Exception as e:
-                    print(e)
-                    time.sleep(30)
-                    continue
-            if not push_done:
-                raise Exception("Failed to mirror branch into {}".format(self.push_url))
-            owner = repo.owner.login
-
-        head = f"{owner}:{head_branch}"
+
+        head = f"{owner}:{branch}"
         if self.check_if_pull_request_exists(repo, head):
             print("PR already exists...")
             return True



More information about the llvm-commits mailing list