-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
46 lines (35 loc) · 914 Bytes
/
main.go
File metadata and controls
46 lines (35 loc) · 914 Bytes
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
43
44
45
46
package main
import (
"flag"
"log"
"github.com/google/go-github/github"
"golang.org/x/oauth2"
)
var accessToken string
var owner string
func main() {
token := flag.String("t", "", "access token")
milestone := flag.String("m", "", "milestone")
owner := flag.String("o", "", "owner")
repo := flag.String("r", "", "repository")
flag.Parse()
if token == nil || milestone == nil || owner == nil || repo == nil {
log.Fatalln("The parameter is not enough")
}
ts := oauth2.StaticTokenSource(
&oauth2.Token{AccessToken: *token},
)
tc := oauth2.NewClient(oauth2.NoContext, ts)
client := github.NewClient(tc)
opt := github.IssueListByRepoOptions{
Milestone: *milestone,
State: "closed",
}
issues, _, err := client.Issues.ListByRepo(*owner, *repo, &opt)
if err != nil {
log.Fatalln(err)
}
for _, issue := range issues {
log.Printf("[%s](%s)", *issue.Title, *issue.HTMLURL)
}
}