func()

in tools/commentMonitor/client.go [68:87]


func (c commentMonitorClient) verifyUser() error {
	if c.shouldVerifyUser {
		var allowed bool
		allowedAssociations := []string{"COLLABORATOR", "MEMBER", "OWNER"}
		for _, a := range allowedAssociations {
			if a == c.ghClient.authorAssociation {
				allowed = true
			}
		}
		if !allowed {
			b := fmt.Sprintf("@%s is not a org member nor a collaborator and cannot execute benchmarks.", c.ghClient.author)
			if err := c.ghClient.postComment(b); err != nil {
				return fmt.Errorf("%v : couldn't post comment", err)
			}
			return fmt.Errorf("author is not a member or collaborator")
		}
		log.Println("author is a member or collaborator")
	}
	return nil
}