[llvm] 89d3c96 - workflows: Fix pull request creation for backports

Tom Stellard via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 27 13:12:50 PDT 2022


Author: Tom Stellard
Date: 2022-07-27T13:12:07-07:00
New Revision: 89d3c9634b15c3b3f56c7e1b37644f9eb7413dc6

URL: https://github.com/llvm/llvm-project/commit/89d3c9634b15c3b3f56c7e1b37644f9eb7413dc6
DIFF: https://github.com/llvm/llvm-project/commit/89d3c9634b15c3b3f56c7e1b37644f9eb7413dc6.diff

LOG: workflows: Fix pull request creation for backports

This was broken by 17d4796cc84618e9b15f9484e5576127c431bc60.

Added: 
    

Modified: 
    llvm/utils/git/github-automation.py

Removed: 
    


################################################################################
diff  --git a/llvm/utils/git/github-automation.py b/llvm/utils/git/github-automation.py
index 8699bda7b18fc..f1ce69df1f1a8 100755
--- a/llvm/utils/git/github-automation.py
+++ b/llvm/utils/git/github-automation.py
@@ -301,7 +301,7 @@ def check_if_pull_request_exists(self, repo:github.Repository.Repository, head:s
         pulls = repo.get_pulls(head=head)
         return pulls.totalCount != 0
 
-    def create_pull_request(self, owner:str, branch:str) -> bool:
+    def create_pull_request(self, owner:str, repo_name:str, branch:str) -> bool:
         """
         reate a pull request in `self.branch_repo_name`.  The base branch of the
         pull request will be choosen based on the the milestone attached to
@@ -327,7 +327,7 @@ def create_pull_request(self, owner:str, branch:str) -> bool:
             push_done = False
             for i in range(0,5):
                 try:
-                    local_repo.git.fetch(f'https://github.com/{owner}/llvm-project', f'{branch}:{branch}')
+                    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
@@ -392,8 +392,9 @@ def execute_command(self) -> bool:
                 m = re.match('([^/]+)/([^/]+)/(.+)', args)
                 if m:
                     owner = m.group(1)
+                    repo = m.group(2)
                     branch = m.group(3)
-                    return self.create_pull_request(owner, branch)
+                    return self.create_pull_request(owner, repo, branch)
 
         print("Do not understand input:")
         print(sys.stdin.readlines())


        


More information about the llvm-commits mailing list