[PATCH] D123657: [workflow] Don't fail workflow if we already have a PR for an issue
Tobias Hieta via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri May 27 07:02:54 PDT 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG49ad577c0772: [workflow] Don't fail workflow if we already have a PR for an issue (authored by thieta).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D123657/new/
https://reviews.llvm.org/D123657
Files:
llvm/utils/git/github-automation.py
Index: llvm/utils/git/github-automation.py
===================================================================
--- llvm/utils/git/github-automation.py
+++ llvm/utils/git/github-automation.py
@@ -191,6 +191,9 @@
self.issue_remove_cherry_pick_failed_label()
return True
+ def check_if_pull_request_exists(self, repo:github.Repository.Repository, head:str) -> bool:
+ pulls = repo.get_pulls(head=head)
+ return pulls != None
def create_pull_request(self, owner:str, branch:str) -> bool:
"""
@@ -208,11 +211,15 @@
release_branch_for_issue = self.release_branch_for_issue
if release_branch_for_issue is None:
return False
+ head = f"{owner}:{branch}"
+ if self.check_if_pull_request_exists(repo, head):
+ print("PR already exists...")
+ return True
try:
- pull = repo.create_pull(title='PR for {}'.format(issue_ref),
+ pull = repo.create_pull(title=f"PR for {issue_ref}",
body='resolves {}'.format(issue_ref),
base=release_branch_for_issue,
- head='{}:{}'.format(owner, branch),
+ head=head,
maintainer_can_modify=False)
except Exception as e:
self.issue_notify_pull_request_failure(branch)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123657.432549.patch
Type: text/x-patch
Size: 1440 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220527/a9b4be88/attachment.bin>
More information about the llvm-commits
mailing list