-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
33 lines (28 loc) · 665 Bytes
/
main.go
File metadata and controls
33 lines (28 loc) · 665 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
package main
import (
"context"
"fmt"
"os"
"github.com/gofri/go-github-ratelimit/github_ratelimit"
"github.com/google/go-github/v50/github"
"golang.org/x/oauth2"
)
func main() {
ctx := context.Background()
ts := oauth2.StaticTokenSource(
&oauth2.Token{AccessToken: os.Getenv("GITHUB_TOKEN")},
)
tc := oauth2.NewClient(ctx, ts)
rateLimiter, err := github_ratelimit.NewRateLimitWaiterClient(tc.Transport)
if err != nil {
panic(err)
}
client := github.NewClient(rateLimiter)
orgs, _, err := client.Organizations.List(context.Background(), "mmlb", nil)
if err != nil {
panic(err)
}
for _, o := range orgs {
fmt.Println(o.GetLogin())
}
}