[llvm] f243d86 - [llvm][utils] Handle Issue/PR authors having no display name set (#186094)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 24 02:54:15 PDT 2026
Author: David Spickett
Date: 2026-03-24T09:54:09Z
New Revision: f243d8656b11e915f6edbffeed2c4afefb67a69f
URL: https://github.com/llvm/llvm-project/commit/f243d8656b11e915f6edbffeed2c4afefb67a69f
DIFF: https://github.com/llvm/llvm-project/commit/f243d8656b11e915f6edbffeed2c4afefb67a69f.diff
LOG: [llvm][utils] Handle Issue/PR authors having no display name set (#186094)
user.login is the account name and user.name is an optional display name
(often their full name). I got an email generated from a colleague's PR
that said:
```
Author: None (<their username>)
```
As they hadn't set user.name in their account. Which isn't a problem,
but it would be neater if we didn't print None.
So I've added a helper function to handle that. If the user has set
both, the output is as it was before, if the user has not, we just show
the login name.
The login name can apparently be None too. In that case we'll print
"None" for it. This does not seem to be a common case though, and I'm
not sure printing anything else would be any more useful.
Added:
Modified:
llvm/utils/git/github-automation.py
Removed:
################################################################################
diff --git a/llvm/utils/git/github-automation.py b/llvm/utils/git/github-automation.py
index 57a4e45201a84..91289bc9b908b 100755
--- a/llvm/utils/git/github-automation.py
+++ b/llvm/utils/git/github-automation.py
@@ -60,6 +60,18 @@ def escape_description(str):
return str
+def format_author(user) -> str:
+ # user.login is the account name, which everyone has. In theory it can be None,
+ # perhaps for closed accounts. user.name is a longer display name for example
+ # "First Last", which not everyone has set.
+ author = "Author: "
+ if user.name is not None:
+ author += f"{user.name} ({user.login})"
+ else:
+ author += f"{user.login}"
+ return author
+
+
class IssueSubscriber:
@property
def team_name(self) -> str:
@@ -88,7 +100,7 @@ def run(self) -> bool:
comment = f"""
@llvm/{team.slug}
-Author: {self.issue.user.name} ({self.issue.user.login})
+{format_author(self.issue.user)}
<details>
{body}
@@ -183,7 +195,7 @@ def run(self) -> bool:
{self.COMMENT_TAG}
{team_mention}
-Author: {self.pr.user.name} ({self.pr.user.login})
+{format_author(self.pr.user)}
<details>
<summary>Changes</summary>
More information about the llvm-commits
mailing list