Skip to content

Commit 2f7544c

Browse files
author
Tom Hieß
committed
fixed version override
1 parent 8fe1c16 commit 2f7544c

2 files changed

Lines changed: 27 additions & 8 deletions

File tree

src/acigithub/issues.go

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,33 @@ var (
1414
)
1515

1616
func 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{
1821
Direction: &direction,
19-
// Sort: &sort,
22+
Sort: &sort,
2023
ListOptions: github.ListOptions{
2124
PerPage: 100,
2225
Page: 1,
2326
},
2427
}
2528
issueComments, _, err = GithubClient.Issues.ListComments(ctx, owner, repo, issueNumber, commentOpts)
26-
return
29+
30+
if err == nil {
31+
icCount := len(issueComments)
32+
issueCommentsSorted := make([]*github.IssueComment, icCount)
33+
34+
for i, n := range issueComments {
35+
j := icCount - i - 1
36+
37+
issueCommentsSorted[j] = n
38+
}
39+
40+
return issueCommentsSorted, err
41+
}
42+
43+
return nil, err
2744
}
2845

2946
func CommentHelpToPullRequest(number int) (err error) {
@@ -35,7 +52,7 @@ func CommentHelpToPullRequest(number int) (err error) {
3552
Direction: &direction,
3653
Sort: &sort,
3754
ListOptions: github.ListOptions{
38-
PerPage: 30,
55+
PerPage: 100,
3956
Page: 1,
4057
},
4158
}

src/acigithub/pullrequest.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,18 +79,20 @@ func GetPrInfos(prNumber int, mergeCommitSha string) (standardPrInfos *models.St
7979
for _, comment := range issueComments {
8080
// Must have permission in the repo to create a major version
8181
// MANNEQUIN|NONE https://docs.github.com/en/graphql/reference/enums#commentauthorassociation
82-
if strings.Contains("OWNER|CONTRIBUTOR|COLLABORATOR", *comment.AuthorAssociation) {
82+
if strings.Contains("MEMBER|OWNER|CONTRIBUTOR|COLLABORATOR", *comment.AuthorAssociation) {
8383
aciVersionOverride := regexp.MustCompile(`aci_version_override: ([0-9]+\.[0-9]+\.[0-9]+)`)
8484
aciPatchLevel := regexp.MustCompile(`aci_patch_level: ([a-zA-Z]+)`)
8585

86-
if aciPatchLevel.MatchString(*comment.Body) {
87-
patchLevel = semver.ParsePatchLevel(aciPatchLevel.FindStringSubmatch(*comment.Body)[1])
88-
break
89-
}
9086
if aciVersionOverride.MatchString(*comment.Body) {
9187
version = aciVersionOverride.FindStringSubmatch(*comment.Body)[1]
9288
break
9389
}
90+
91+
if aciPatchLevel.MatchString(*comment.Body) {
92+
patchLevel = semver.ParsePatchLevel(aciPatchLevel.FindStringSubmatch(*comment.Body)[1])
93+
break
94+
}
95+
9496
}
9597
}
9698

0 commit comments

Comments
 (0)