@@ -28,13 +28,14 @@ type RepoSummary struct {
2828
2929func main () {
3030 var (
31- orgName , userName , token , tokenFile , repoList , reposFile string
32- days int
33- punchCard , byRepo bool
31+ orgName , userName , token , tokenFile , repoList , reposFile , apiUrl string
32+ days int
33+ punchCard , byRepo bool
3434 )
3535
3636 flag .StringVar (& orgName , "org" , "" , "Organization name" )
3737 flag .StringVar (& userName , "user" , "" , "User name" )
38+ flag .StringVar (& apiUrl , "apiUrl" , "" , "Override Github API URL" )
3839 flag .StringVar (& token , "token" , "" , "GitHub token" )
3940 flag .StringVar (& tokenFile , "token-file" , "" , "Path to the file containing the GitHub token" )
4041 flag .StringVar (& repoList , "include" , "" , "List of repos you want stats for eg. 'org/repo1,org/repo2'" )
@@ -67,6 +68,13 @@ func main() {
6768 }
6869
6970 client := github .NewClient (auth )
71+ if len (apiUrl ) > 0 {
72+ var err error
73+ client , err = github .NewEnterpriseClient (apiUrl , "" , auth )
74+ if err != nil {
75+ log .Fatal (err )
76+ }
77+ }
7078 created := time .Now ().AddDate (0 , 0 , - days )
7179 format := "2006-01-02"
7280 createdQuery := ">=" + created .Format (format )
@@ -126,7 +134,7 @@ func main() {
126134 log .Fatal (err )
127135 }
128136
129- if res .Rate .Remaining == 0 {
137+ if res .Rate .Limit > 0 && res . Rate . Remaining == 0 {
130138 panic ("Rate limit exceeded" )
131139 }
132140
0 commit comments