Skip to content

Commit

Permalink
cmd/releasebot: use comment ID in updateGithubComment
Browse files Browse the repository at this point in the history
When editing a comment, the current code used the issue number in place
of the comment ID. But the EditComment endpoint needs the comment ID.

The issue number is not needed at all in updateGithubComment because the
EditComment endpoint uses the repository and comment ID to uniquely
identify the comment.

References:

-	https://developer.github.com/v3/issues/comments/#edit-a-comment.
-	https://godoc.org/github.com/google/go-github/github#IssuesService.EditComment.

Updates golang/go#24598.
Updates google/go-github#883.
Updates google/go-github#597.

Change-Id: Iae9d967d7be7a75b1bcee7118a3c80fe8f2375b4
Reviewed-on: https://go-review.googlesource.com/103398
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
  • Loading branch information
dmitshur committed Mar 30, 2018
1 parent de8714b commit 35ebb6b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions cmd/releasebot/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -336,9 +336,8 @@ func findGithubComment(number int, prefix string) *github.IssueComment {
return nil
}

func updateGithubComment(number int, com *github.IssueComment, body string) error {
_, _, err := githubClient.Issues.EditComment(context.TODO(), projectOwner, projectRepo, int64(number), &github.IssueComment{
ID: com.ID,
func updateGithubComment(com *github.IssueComment, body string) error {
_, _, err := githubClient.Issues.EditComment(context.TODO(), projectOwner, projectRepo, com.GetID(), &github.IssueComment{
Body: &body,
})
return err
Expand Down
2 changes: 1 addition & 1 deletion cmd/releasebot/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ func (w *Work) buildReleases() {
println("POSTING")
com := findGithubComment(w.ReleaseIssue.GetNumber(), "## "+w.Version+" ")
if com != nil {
updateGithubComment(w.ReleaseIssue.GetNumber(), com, md.String())
updateGithubComment(com, md.String())
} else {
postGithubComment(w.ReleaseIssue.GetNumber(), md.String())
}
Expand Down

0 comments on commit 35ebb6b

Please sign in to comment.