[llvm] [GitHub] Add workflow to check author's commit access on new PRs (PR #123593)

Mats Jun Larsen via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 20 05:47:08 PST 2025


================
@@ -290,6 +290,32 @@ def run(self) -> bool:
         return True
 
 
+class CheckCommitAccess:
+    def __init__(self, token: str, repo: str, pr_number: int, author: str):
+        self.repo = github.Github(token).get_repo(repo)
+        self.pr = self.repo.get_issue(pr_number).as_pull_request()
+        self.author = author
+
+    def can_merge(self, user: str) -> bool:
+        try:
+            return self.repo.get_collaborator_permission(user) in ["admin", "write"]
----------------
junlarsen wrote:

Interesting that pygithub truncates so much of the response :thinking: 

I would say the current solution is good to go then.

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


More information about the llvm-commits mailing list