From 62382bd1ab83aa699379741124b769f2a6cd52ad Mon Sep 17 00:00:00 2001 From: Kevin Zita Date: Mon, 6 Aug 2018 01:50:40 -0400 Subject: [PATCH 1/2] cmd/gopherbot: change issue notification comment to include author name --- cmd/gopherbot/gopherbot.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/cmd/gopherbot/gopherbot.go b/cmd/gopherbot/gopherbot.go index ae56698143..7f991f8caf 100644 --- a/cmd/gopherbot/gopherbot.go +++ b/cmd/gopherbot/gopherbot.go @@ -806,7 +806,7 @@ func (b *gopherbot) closeStaleWaitingForInfo(ctx context.Context) error { } -// cl2issue writes "Change https://golang.org/issue/NNNN mentions this issue"\ +// cl2issue writes "Change https://golang.org/issue/NNNN by 'author' mentions this issue"\ // and the change summary on GitHub when a new Gerrit change references a GitHub issue. func (b *gopherbot) cl2issue(ctx context.Context) error { monthAgo := time.Now().Add(-30 * 24 * time.Hour) @@ -831,7 +831,7 @@ func (b *gopherbot) cl2issue(ctx context.Context) error { continue } hasComment := false - substr := fmt.Sprintf("%d mentions this issue", cl.Number) + substr := fmt.Sprintf("Change https://golang.org/cl/%d by %s mentions this issue: `%s`", cl.Number) gi.ForeachComment(func(c *maintner.GitHubComment) error { if strings.Contains(c.Body, substr) { hasComment = true @@ -841,7 +841,11 @@ func (b *gopherbot) cl2issue(ctx context.Context) error { }) if !hasComment { printIssue("cl2issue", gi) - msg := fmt.Sprintf("Change https://golang.org/cl/%d mentions this issue: `%s`", cl.Number, cl.Commit.Summary()) +<<<<<<< HEAD + msg := fmt.Sprintf("Change https://golang.org/cl/%d by %s mentions this issue: `%s`", cl.Number, strings.Split("cl.Commit.Author", "<")[0], cl.Commit.Summary()) +======= + msg := fmt.Sprintf("Change https://golang.org/cl/%d by @%s mentions this issue: `%s`", cl.Number, cl.Commit.Author, cl.Commit.Summary()) +>>>>>>> 04e54a31def4afb0784d367372b9736182f2e172 if err := b.addGitHubComment(ctx, "golang", "go", gi.Number, msg); err != nil { return err } From 405e2fdee4ad530f09459ee7dbb818338407104c Mon Sep 17 00:00:00 2001 From: Kevin Zita Date: Sun, 18 Nov 2018 22:47:53 -0500 Subject: [PATCH 2/2] cmd/gopherbot: change issue nitification comment to include authoer name --- cmd/gopherbot/gopherbot.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/cmd/gopherbot/gopherbot.go b/cmd/gopherbot/gopherbot.go index 7f991f8caf..462754ef4c 100644 --- a/cmd/gopherbot/gopherbot.go +++ b/cmd/gopherbot/gopherbot.go @@ -831,7 +831,7 @@ func (b *gopherbot) cl2issue(ctx context.Context) error { continue } hasComment := false - substr := fmt.Sprintf("Change https://golang.org/cl/%d by %s mentions this issue: `%s`", cl.Number) + substr := fmt.Sprintf("Change https://golang.org/cl/%d mentions this issue.", cl.Number) gi.ForeachComment(func(c *maintner.GitHubComment) error { if strings.Contains(c.Body, substr) { hasComment = true @@ -841,11 +841,9 @@ func (b *gopherbot) cl2issue(ctx context.Context) error { }) if !hasComment { printIssue("cl2issue", gi) -<<<<<<< HEAD + msg := fmt.Sprintf("Change https://golang.org/cl/%d by %s mentions this issue: `%s`", cl.Number, strings.Split("cl.Commit.Author", "<")[0], cl.Commit.Summary()) -======= - msg := fmt.Sprintf("Change https://golang.org/cl/%d by @%s mentions this issue: `%s`", cl.Number, cl.Commit.Author, cl.Commit.Summary()) ->>>>>>> 04e54a31def4afb0784d367372b9736182f2e172 + if err := b.addGitHubComment(ctx, "golang", "go", gi.Number, msg); err != nil { return err }