TBR: devtools/presubmit: add email whitelist
and add Aaron to the list.
Change-Id: I220039496d7f2c56bfce584c3c50e959cc915c11
diff --git a/presubmit/query.go b/presubmit/query.go
index 415eaba..f662481 100644
--- a/presubmit/query.go
+++ b/presubmit/query.go
@@ -32,6 +32,11 @@
var (
queryStringFlag string
logFilePathFlag string
+
+ emailWhitelist = []string{
+ "aaron@azinman.com",
+ "aaron@empiric.al",
+ }
)
func init() {
@@ -456,9 +461,7 @@
skipPresubmitTest = true
}
- if !strings.HasSuffix(curCL.OwnerEmail(), "@google.com") {
- hasNonGoogleOwner = true
- }
+ hasNonGoogleOwner = !checkEmailAddress(curCL.OwnerEmail())
projects = append(projects, curCL.Project)
refs = append(refs, curCL.Reference())
@@ -685,3 +688,17 @@
}
return nil
}
+
+// checkEmailAddress checks whether the given email address is from Google or
+// is whitelisted.
+func checkEmailAddress(email string) bool {
+ fromGoogle := strings.HasSuffix(email, "@google.com")
+ whiteListed := false
+ for _, we := range emailWhitelist {
+ if we == strings.ToLower(email) {
+ whiteListed = true
+ break
+ }
+ }
+ return fromGoogle || whiteListed
+}