Skip to content

Commit ece77f7

Browse files
committed
Handle GitHub bots that have invalid characters in their username
1 parent 7647ace commit ece77f7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

github-merge.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,9 @@ def sanitize_ghdata(rec):
8989
rec['user'] = {'login': '[deleted]'}
9090
else:
9191
# "Github username may only contain alphanumeric characters or hyphens'.
92+
# Sometimes bot have a "[bot]" suffix in the login, so we also match for that
9293
# Use \Z instead of $ to not match final newline only end of string.
93-
if not re.match('[a-zA-Z0-9-]+\Z', rec['user']['login'], re.DOTALL):
94+
if not re.match('[a-zA-Z0-9-]+(\[bot\])?\Z', rec['user']['login'], re.DOTALL):
9495
raise ValueError('Github username contains invalid characters: {}'.format(sanitize(rec['user']['login'])))
9596
return rec
9697

0 commit comments

Comments
 (0)