diff --git a/main.go b/main.go index 31e4160..c87a3c0 100644 --- a/main.go +++ b/main.go @@ -18,7 +18,7 @@ func main() { app.Name = "email plugin" app.Usage = "email plugin" app.Action = run - app.Version = "2.0.1" + app.Version = "2.0.2" app.Flags = []cli.Flag{ // Plugin environment cli.StringFlag{ diff --git a/plugin.go b/plugin.go index 0ec19ca..b1ad955 100644 --- a/plugin.go +++ b/plugin.go @@ -110,7 +110,16 @@ func (p Plugin) Exec() error { var dialer *gomail.Dialer if !p.Config.RecipientsOnly { - p.Config.Recipients = append(p.Config.Recipients, p.Commit.Author.Email) + exists := false + for _, recipient := range p.Config.Recipients { + if recipient == p.Commit.Author.Email { + exists = true + } + } + + if !exists { + p.Config.Recipients = append(p.Config.Recipients, p.Commit.Author.Email) + } } if p.Config.Username == "" && p.Config.Password == "" {