@@ -14,16 +14,30 @@ var (
1414)
1515
1616func GetIssueComments (issueNumber int ) (issueComments []* github.IssueComment , err error ) {
17+
18+ //FIXME: currently the GitHub API ignores Direction and Sort
19+ // so, we are using the default settings for the query and sorting the response afterwards
1720 var commentOpts = & github.IssueListCommentsOptions {
18- Direction : & direction ,
19- // Sort: &sort,
20- ListOptions : github.ListOptions {
21- PerPage : 100 ,
22- Page : 1 ,
23- },
21+ Direction : & direction ,
22+ Sort : & sort ,
23+ ListOptions : standardListOptions ,
2424 }
2525 issueComments , _ , err = GithubClient .Issues .ListComments (ctx , owner , repo , issueNumber , commentOpts )
26- return
26+
27+ if err == nil {
28+ icCount := len (issueComments )
29+ issueCommentsSorted := make ([]* github.IssueComment , icCount )
30+
31+ for i , n := range issueComments {
32+ j := icCount - i - 1
33+
34+ issueCommentsSorted [j ] = n
35+ }
36+
37+ return issueCommentsSorted , err
38+ }
39+
40+ return nil , err
2741}
2842
2943func CommentHelpToPullRequest (number int ) (err error ) {
@@ -32,12 +46,9 @@ func CommentHelpToPullRequest(number int) (err error) {
3246 }
3347
3448 var commentOpts = & github.IssueListCommentsOptions {
35- Direction : & direction ,
36- Sort : & sort ,
37- ListOptions : github.ListOptions {
38- PerPage : 30 ,
39- Page : 1 ,
40- },
49+ Direction : & direction ,
50+ Sort : & sort ,
51+ ListOptions : standardListOptions ,
4152 }
4253 comments , _ , err := GithubClient .Issues .ListComments (ctx , owner , repo , number , commentOpts )
4354 if err != nil {
0 commit comments