Skip to content

Commit 8d618e4

Browse files
committed
GetAssignees fix
1 parent 7a15012 commit 8d618e4

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

bot/connector/github/builder.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import (
1111
"net/http"
1212
"path/filepath"
1313

14+
"strings"
15+
1416
"github.com/bivas/rivi/bot"
1517
"github.com/bivas/rivi/util"
1618
)
@@ -63,7 +65,7 @@ func (builder *eventDataBuilder) readFromJson(payload *payload) {
6365
builder.data.additions = payload.PullRequest.Additions
6466
builder.data.deletions = payload.PullRequest.Deletions
6567
builder.data.ref = payload.PullRequest.Base.Ref
66-
builder.data.origin = payload.PullRequest.User.Login
68+
builder.data.origin = strings.ToLower(payload.PullRequest.User.Login)
6769
builder.data.state = payload.PullRequest.State
6870
}
6971

bot/connector/github/client.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ package github
22

33
import (
44
"context"
5+
"strings"
6+
57
"github.com/bivas/rivi/bot"
68
"github.com/bivas/rivi/util"
79
"github.com/google/go-github/github"
@@ -69,12 +71,12 @@ func (c *ghClient) RemoveLabel(issue int, label string) []string {
6971
func (c *ghClient) GetAssignees(issue int) []string {
7072
util.Logger.Debug("Getting assignees for issue %d", issue)
7173
result := make([]string, 0)
72-
users, _, err := c.client.Issues.ListAssignees(context.Background(), c.owner, c.repo, nil)
74+
issueObject, _, err := c.client.Issues.Get(context.Background(), c.owner, c.repo, issue)
7375
if err != nil {
7476
util.Logger.Error("Unable to get assignees for issue %d. %s", issue, err)
7577
} else {
76-
for _, p := range users {
77-
result = append(result, *p.Login)
78+
for _, p := range issueObject.Assignees {
79+
result = append(result, strings.ToLower(*p.Login))
7880
}
7981
}
8082
return result

0 commit comments

Comments
 (0)