forked from yshnb/github-stat
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
init commit : statistics analysis of the numbers of merged/LGTM'ed/No…
…nLGTM'ed(open) PRs in specified repos for specified user(s)
- Loading branch information
1 parent
810b40b
commit 2abffd7
Showing
11 changed files
with
344 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,29 @@ | ||
# github-stat | ||
# github-contrib-stats | ||
|
||
tutorial for myself to write in golang and to use [go-github](https://github.com/google/go-github) | ||
this repository is originally forked from https://github.com/yshnb/github-stat, this repo does different jobs. | ||
this repo does statistics analysis of the numbers of merged/LGTM'ed/NonLGTM'ed(open) PRs in specified repos for specified user(s) | ||
|
||
## Usage | ||
|
||
1. `git clone https://github.com/yshnb/github-stat.git` | ||
2. `cd ./github-stat` | ||
3. `cp config.json.dist config.json` | ||
4. fill in valid `accessToken` generated in Github | ||
1. `go get -u github.com/google/go-github/github` | ||
2. `go get -u github.com/mgutz/ansi` | ||
3. `go get -u golang.org/x/oauth2` | ||
4. `go get -u github.com/olekukonko/tablewriter` | ||
5. `git clone https://github.com/yshnb/github-stat.git` | ||
6. `cd ./github-stat` | ||
7. `cp config.toml.dist config.toml` | ||
8. fill in valid `accessToken` generated from https://github.com/settings/tokens | ||
9. fill in other fields. | ||
|
||
After, you can run the below command | ||
``` | ||
$ go run main.go --metrics=star google/go-github | ||
target repository: google/go-github | ||
metrics: star | ||
star: 1079 | ||
$ go run main.go | ||
...... | ||
+--------------+--------+---------+------------+ | ||
| NAME | MERGED | LGTM'ED | NONLGTM'ED | | ||
+--------------+--------+---------+------------+ | ||
| bruceauyeung | 10 | 0 | 6 | | ||
| tanshanshan | 8 | 0 | 6 | | ||
+--------------+--------+---------+------------+ | ||
``` | ||
like this. | ||
|
||
## Available metrics | ||
|
||
For now, it can only get the numbers of github star in each repository. | ||
|
||
My plan .... | ||
|
||
- issue | ||
- pull_requests (open/closed) | ||
- code changes(additions/deletions) | ||
- etc. | ||
|
||
like this. |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
statBeginTime = 2016-10-01T00:00:00 | ||
accessToken = "0161c6ec49fb95d2d04550c72965dd55921bb775" | ||
users = ["bruceauyeung","tanshanshan"] | ||
repos = ["kubernetes/*"] | ||
metrics = "pr" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
statBeginTime = 2016-10-01T00:00:00 | ||
accessToken = "personal access token" | ||
users = ["bruceauyeung","tanshanshan"] | ||
repos = ["kubernetes/*"] | ||
metrics = "pr" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,28 @@ | ||
package githubstat | ||
|
||
import ( | ||
"encoding/json" | ||
"io/ioutil" | ||
"time" | ||
|
||
"github.com/BurntSushi/toml" | ||
) | ||
|
||
type Load interface { | ||
} | ||
|
||
var config Config | ||
var Config Configuration | ||
|
||
type Config struct { | ||
AccessToken string | ||
OrgName string | ||
type Configuration struct { | ||
StatBeginTime time.Time | ||
AccessToken string | ||
Users []string | ||
Repos []string | ||
Metrics string | ||
} | ||
|
||
// read config file | ||
var _ = func() int { | ||
file, err := ioutil.ReadFile("./config.json") | ||
if err != nil { | ||
if _, err := toml.DecodeFile("./config.toml", &Config); err != nil { | ||
panic(err) | ||
} | ||
json.Unmarshal(file, &config) | ||
return 0 | ||
}() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.