mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-18 00:54:19 +01:00
merge-pr.py: Fix random emails appearing in commit logs
...my good friend Claude was probably drunk when he wrote that code.
This commit is contained in:
@@ -41,13 +41,7 @@ def get_user_email(g, username):
|
|||||||
name = user.name if user.name else username
|
name = user.name if user.name else username
|
||||||
if user.email:
|
if user.email:
|
||||||
return f"{name} <{user.email}>"
|
return f"{name} <{user.email}>"
|
||||||
# If public email is not available, try to get from events
|
return f"{name} (@{username})"
|
||||||
events = user.get_events()
|
|
||||||
for event in events:
|
|
||||||
if event.type == "PushEvent" and event.payload.get("commits"):
|
|
||||||
for commit in event.payload["commits"]:
|
|
||||||
if commit.get("author") and commit["author"].get("email"):
|
|
||||||
return f"{name} <{commit['author']['email']}>"
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Error fetching email for user {username}: {str(e)}")
|
print(f"Error fetching email for user {username}: {str(e)}")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user