roll_util: Don't mangle service account emails
Leave service account emails as-is when creating roll CLs.
Change-Id: Icd94b7f6294cec1f429be93c2d400d1aefd42b18
Reviewed-on: https://pigweed-review.googlesource.com/c/infra/recipes/+/99000
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
Pigweed-Auto-Submit: Rob Mohr <mohrr@google.com>
Reviewed-by: Ted Pudlik <tpudlik@google.com>
diff --git a/recipe_modules/roll_util/api.py b/recipe_modules/roll_util/api.py
index ac74465..3553d05 100644
--- a/recipe_modules/roll_util/api.py
+++ b/recipe_modules/roll_util/api.py
@@ -318,9 +318,11 @@
def fake_author(self, author):
# Update the author's email address so it can be used for attribution
# without literally attributing it to the author's account in Gerrit.
+ # Make sure not to add it twice, and there's no need to do this for
+ # service accounts.
email = author.email
prefix = 'pigweed.infra.roller.'
- if prefix not in email:
+ if prefix not in email and not email.endswith('gserviceaccount.com'):
user, domain = author.email.split('@')
email = '{}@{}{}'.format(user, prefix, domain)