-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathutil.go
42 lines (36 loc) · 815 Bytes
/
util.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package triage
import (
"strings"
"github.com/google/go-github/v28/github"
)
// filterNotifications using the given text.
func filterNotifications(notifications []*github.Notification, s string) (filtered []*github.Notification) {
for _, n := range notifications {
if !strings.Contains(n.Repository.GetFullName(), s) {
continue
}
filtered = append(filtered, n)
}
return
}
// ownerRepo returns the owner and repo.
func ownerRepo(n *github.Notification) (owner, repo string) {
repository := n.GetRepository()
owner = repository.GetOwner().GetLogin()
repo = repository.GetName()
return
}
// min returns the minimum of two ints.
func min(a, b int) int {
if a < b {
return a
}
return b
}
// max returns the maximum of two ints.
func max(a, b int) int {
if a > b {
return a
}
return b
}