diff --git a/vcsclient/github.go b/vcsclient/github.go index 5e6bca03..6749d4b8 100644 --- a/vcsclient/github.go +++ b/vcsclient/github.go @@ -473,7 +473,7 @@ func (client *GitHubClient) ListPullRequestReviewComments(ctx context.Context, o if err != nil { return nil, err } - commentsList, _, err := ghClient.PullRequests.ListReviews(ctx, owner, repository, pullRequestID, nil) + commentsList, _, err := ghClient.PullRequests.ListComments(ctx, owner, repository, pullRequestID, nil) if err != nil { return []CommentInfo{}, err } @@ -482,7 +482,7 @@ func (client *GitHubClient) ListPullRequestReviewComments(ctx context.Context, o commentsInfoList = append(commentsInfoList, CommentInfo{ ID: comment.GetID(), Content: comment.GetBody(), - Created: comment.GetSubmittedAt(), + Created: comment.GetCreatedAt(), }) } return commentsInfoList, nil diff --git a/vcsclient/github_test.go b/vcsclient/github_test.go index 2e0843f3..2535b11c 100644 --- a/vcsclient/github_test.go +++ b/vcsclient/github_test.go @@ -314,7 +314,8 @@ func TestGitHubClient_ListPullRequestReviewComments(t *testing.T) { ctx := context.Background() id := int64(1) body := "test" - client, cleanUp := createServerAndClient(t, vcsutils.GitHub, false, []*github.PullRequestReview{{ID: &id, Body: &body}}, "/repos/jfrog/repo-1/pulls/1/reviews", createGitHubHandler) + created := time.Date(1970, time.January, 1, 0, 0, 0, 0, time.UTC) + client, cleanUp := createServerAndClient(t, vcsutils.GitHub, false, []*github.PullRequestComment{{ID: &id, Body: &body, CreatedAt: &created}}, "/repos/jfrog/repo-1/pulls/1/comments", createGitHubHandler) defer cleanUp() commentInfo, err := client.ListPullRequestReviewComments(ctx, owner, repo1, 1) @@ -322,6 +323,7 @@ func TestGitHubClient_ListPullRequestReviewComments(t *testing.T) { assert.Len(t, commentInfo, 1) assert.Equal(t, id, commentInfo[0].ID) assert.Equal(t, body, commentInfo[0].Content) + assert.Equal(t, created, commentInfo[0].Created) commentInfo, err = createBadGitHubClient(t).ListPullRequestReviewComments(ctx, owner, repo1, 1) assert.Nil(t, commentInfo)