|
|
@ -0,0 +1,56 @@
|
|
|
1
|
# stars
|
|
|
2
|
|
|
|
3
|
`stars` fetches your GitHub stars and updates them as necessary. It is
|
|
|
4
|
not necessarily limited to just GitHub, as it will accept any git url
|
|
|
5
|
that's publicely accessible.
|
|
|
6
|
|
|
|
7
|
## Usage
|
|
|
8
|
|
|
|
9
|
`stars` accepts the input from various GitHub API endpoints that return
|
|
|
10
|
lists of repositories.
|
|
|
11
|
|
|
|
12
|
```
|
|
|
13
|
# Fetch starred repositories
|
|
|
14
|
$ curl https://api.github.com/users/heyLu/starred | ./stars
|
|
|
15
|
...
|
|
|
16
|
|
|
|
17
|
# Fetch public repos
|
|
|
18
|
$ curl https://api.github.com/users/heyLu/repos | ./stars
|
|
|
19
|
...
|
|
|
20
|
|
|
|
21
|
# Fetch all repos (public, private, org member)
|
|
|
22
|
$ token=<personal access token>
|
|
|
23
|
$ curl -u heyLu:$token https://api.github.com/user/repos | ./stars
|
|
|
24
|
```
|
|
|
25
|
|
|
|
26
|
However, note that GitHub's API uses pagination, so ensure you set the
|
|
|
27
|
`per_page` query parameter appropriately, or use a tool such as
|
|
|
28
|
[unpaginate][] which collects the results from the pages into one JSON
|
|
|
29
|
document:
|
|
|
30
|
|
|
|
31
|
```
|
|
|
32
|
$ unpaginate https://api.github.com/users/heyLu/starred | ./stars
|
|
|
33
|
...
|
|
|
34
|
```
|
|
|
35
|
|
|
|
36
|
[unpaginate]: https://github.com/heyLu/lp/tree/master/go/unpaginate
|
|
|
37
|
|
|
|
38
|
## Input format
|
|
|
39
|
|
|
|
40
|
`stars` reads an array of JSON objects from stdin. It must have
|
|
|
41
|
`full_name` and `git_url` fields, should have a `pushed_at` field and
|
|
|
42
|
also an optional `description` field.
|
|
|
43
|
|
|
|
44
|
For example:
|
|
|
45
|
|
|
|
46
|
```json
|
|
|
47
|
[
|
|
|
48
|
{
|
|
|
49
|
"full_name": "ProseMirror/prosemirror",
|
|
|
50
|
"description": "The ProseMirror WYSIWYM editor",
|
|
|
51
|
"pushed_at": "2015-08-06T21:37:16Z",
|
|
|
52
|
"git_url": "git://github.com/ProseMirror/prosemirror.git",
|
|
|
53
|
},
|
|
|
54
|
...
|
|
|
55
|
]
|
|
|
56
|
```
|