[llvm] Add check for private emails (PR #156106)

via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 29 14:09:32 PDT 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {darker}-->


:warning: Python code formatter, darker found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
darker --check --diff -r origin/main...HEAD llvm/utils/git/email-check-helper.py
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from darker here.
</summary>

``````````diff
--- email-check-helper.py	2025-08-29 21:05:56.000000 +0000
+++ email-check-helper.py	2025-08-29 21:09:03.520134 +0000
@@ -30,33 +30,34 @@
     proc = subprocess.run(
         ["git", "show", "-s", "--format=%ae", "HEAD"],
         stdout=subprocess.PIPE,
         stderr=subprocess.PIPE,
         encoding="utf-8",
-        check=False
+        check=False,
     )
     if proc.returncode == 0:
         return proc.stdout.strip()
     return None
 
 
 def is_private_email(email: Optional[str]) -> bool:
     if not email:
         return False
-    return (email.endswith("noreply.github.com") or
-            email.endswith("users.noreply.github.com"))
+    return email.endswith("noreply.github.com") or email.endswith(
+        "users.noreply.github.com"
+    )
 
 
 def check_user_email(token: str, pr_author: str) -> bool:
     try:
         from github import Github
 
         print(f"Checking email privacy for user: {pr_author}")
-        
+
         api = Github(token)
         user = api.get_user(pr_author)
-        
+
         print(f"User public email: {user.email or 'null (private)'}")
 
         if user.email is not None and is_private_email(user.email):
             return True
 
@@ -87,20 +88,17 @@
         type=str,
         default=os.getenv("GITHUB_REPOSITORY", "llvm/llvm-project"),
         help="The GitHub repository in the form of <owner>/<repo>",
     )
     parser.add_argument(
-        "--issue-number",
-        type=int,
-        required=True,
-        help="The PR number to check"
+        "--issue-number", type=int, required=True, help="The PR number to check"
     )
     parser.add_argument(
         "--pr-author",
         type=str,
         required=True,
-        help="The GitHub username of the PR author"
+        help="The GitHub username of the PR author",
     )
 
     args = parser.parse_args()
 
     has_private_email = check_user_email(args.token, args.pr_author)

``````````

</details>


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


More information about the llvm-commits mailing list