Skip to content

Commit 62382bd

Browse files
committed
cmd/gopherbot: change issue notification comment to include author name
1 parent 4639cd3 commit 62382bd

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

cmd/gopherbot/gopherbot.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,7 @@ func (b *gopherbot) closeStaleWaitingForInfo(ctx context.Context) error {
806806

807807
}
808808

809-
// cl2issue writes "Change https://golang.org/issue/NNNN mentions this issue"\
809+
// cl2issue writes "Change https://golang.org/issue/NNNN by 'author' mentions this issue"\
810810
// and the change summary on GitHub when a new Gerrit change references a GitHub issue.
811811
func (b *gopherbot) cl2issue(ctx context.Context) error {
812812
monthAgo := time.Now().Add(-30 * 24 * time.Hour)
@@ -831,7 +831,7 @@ func (b *gopherbot) cl2issue(ctx context.Context) error {
831831
continue
832832
}
833833
hasComment := false
834-
substr := fmt.Sprintf("%d mentions this issue", cl.Number)
834+
substr := fmt.Sprintf("Change https://golang.org/cl/%d by %s mentions this issue: `%s`", cl.Number)
835835
gi.ForeachComment(func(c *maintner.GitHubComment) error {
836836
if strings.Contains(c.Body, substr) {
837837
hasComment = true
@@ -841,7 +841,11 @@ func (b *gopherbot) cl2issue(ctx context.Context) error {
841841
})
842842
if !hasComment {
843843
printIssue("cl2issue", gi)
844-
msg := fmt.Sprintf("Change https://golang.org/cl/%d mentions this issue: `%s`", cl.Number, cl.Commit.Summary())
844+
<<<<<<< HEAD
845+
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())
846+
=======
847+
msg := fmt.Sprintf("Change https://golang.org/cl/%d by @%s mentions this issue: `%s`", cl.Number, cl.Commit.Author, cl.Commit.Summary())
848+
>>>>>>> 04e54a31def4afb0784d367372b9736182f2e172
845849
if err := b.addGitHubComment(ctx, "golang", "go", gi.Number, msg); err != nil {
846850
return err
847851
}

0 commit comments

Comments
 (0)