File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change
1
+ require 'octokit.rb'
2
+
3
+ if ARGV . length != 1
4
+ $stderr. puts "Pass in the name of the repository you're interested in checking as an argument, as <owner>/<repo>."
5
+ exit 1
6
+ end
7
+
8
+ # !!! DO NOT EVER USE HARD-CODED VALUES IN A REAL APP !!!
9
+ # Instead, set and test environment variables, like below
10
+ client = Octokit ::Client . new ( :access_token => ENV [ 'MY_PERSONAL_TOKEN' ] )
11
+
12
+ REPO = ARGV [ 0 ] . to_s
13
+ owner = REPO . split ( "/" ) [ 0 ]
14
+
15
+ client . forks REPO
16
+ forks = client . last_response . data
17
+ loop do
18
+ last_response = client . last_response
19
+ break if last_response . rels [ :next ] . nil?
20
+ forks . concat last_response . rels [ :next ] . get . data
21
+ end
22
+
23
+ forks . map { |f | f [ :owner ] [ :login ] } . each do |user |
24
+ unless client . organization_member? ( owner , user )
25
+ puts "#{ user } forked #{ REPO } , but is not a member of #{ owner } !"
26
+ end
27
+ end
You can’t perform that action at this time.
0 commit comments