[llvm] [GitHub] Add Greeting comment to new contributor's PRs with useful information (PR #72249)

David Spickett via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 14 08:20:03 PST 2023


================
@@ -211,6 +211,35 @@ def _get_curent_team(self) -> Optional[github.Team.Team]:
         return None
 
 
+class PRGreeter:
+    def __init__(self, token: str, repo: str, pr_number: int):
+        repo = github.Github(token).get_repo(repo)
+        self.pr = repo.get_issue(pr_number).as_pull_request()
+
+    def run(self) -> bool:
+        # We assume that this is only called for a PR that has just been opened.
+
+        # This text is using Markdown formatting.
+        comment = f"""\
----------------
DavidSpickett wrote:

I have seen some prebuilt actions that list all the PRs for a project and keep searching backwards until they see (or don't see) a PR from the same author. Though I wonder how that would work on LLVM's scale.

For now I've used a filter in the job YAML which is more brittle but will catch a decent number of cases.

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


More information about the llvm-commits mailing list