INNER CODE UNIT · Python
extract_github_username_from_email
deltazefiro/Amarok-Hider · .github/scripts/summarize_translation_contrib.py:67
def extract_github_username_from_email(email: str) -> Optional[str]:
"""Extract GitHub username from email address."""
# GitHub noreply format: 25982450+VisionR1@users.noreply.github.com
pattern = r"(\d+\+)?([^@]+)@users\.noreply\.github\.com"
match = re.match(pattern, email)
if match:
return match.group(2)
# Hosted Weblate noreply format
pattern = r"([^@]+)@users\.noreply\.hosted\.weblate\.org"
match = re.match(pattern, email)
if match:
return match.group(1)
return None
# Global cache for API lookups