[llvm] [GitHub][workflows] Ask reviewers to merge PRs when author can not (PR #81142)

Tom Stellard via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 8 14:34:42 PST 2024


================
@@ -298,6 +299,76 @@ def run(self) -> bool:
         return True
 
 
+class PRMergeOnBehalfInformation:
+    COMMENT_TAG = "<!--LLVM MERGE ON BEHALF INFORMATION COMMENT-->\n"
+
+    def __init__(self, token: str, repo: str, pr_number: int, author: str):
+        repo = github.Github(token).get_repo(repo)
+        self.pr = repo.get_issue(pr_number).as_pull_request()
+        self.author = author
+        self.repo = repo
+        self.token = token
+
+    def author_has_push_permission(self):
+        # https://docs.github.com/en/rest/collaborators/collaborators?apiVersion=2022-11-28#get-repository-permissions-for-a-user
+        response = requests.get(
----------------
tstellar wrote:

The alternative way to do this would be to check if someone is in the llvm-committers team.  I know you can do this via the API.  Though, technically, the way it's done here is safer checking team membership.

https://github.com/llvm/llvm-project/pull/81142


More information about the llvm-commits mailing list