Skip to content

Commit fde999f

Browse files
committed
CommentMonitor: return error from ListCommits
Signed-off-by: Bryan Boreham <[email protected]>
1 parent fbf3f0c commit fde999f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

tools/commentMonitor/ghclient.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,13 @@ func (c githubClient) getLastCommitSHA() (string, error) {
7070
// https://developer.github.com/v3/pulls/#list-commits-on-a-pull-request
7171
listops := &github.ListOptions{Page: 1, PerPage: 250}
7272
l, _, err := c.clt.PullRequests.ListCommits(c.ctx, c.owner, c.repo, c.pr, listops)
73+
if err != nil {
74+
return "", fmt.Errorf("ListCommits(%q,%q,%q): %w", c.owner, c.repo, c.pr, err)
75+
}
7376
if len(l) == 0 {
7477
return "", fmt.Errorf("pr does not have a commit")
7578
}
76-
return l[len(l)-1].GetSHA(), err
79+
return l[len(l)-1].GetSHA(), nil
7780
}
7881

7982
func (c githubClient) createRepositoryDispatch(eventType string, clientPayload map[string]string) error {

0 commit comments

Comments
 (0)