The GitHub Org Scrape Tool
GHOST is a set of simple ruby scripts which leverage Octokit in order to produce compliance or auditing... are you bored yet? I am. I just want to know if there are any ghosts in my org.
You're here because you need to make lists. These simple scripts will allow you to:
- List users in a GitHub Organization
- List the teams in a GitHub Organization
- List the users on the teams in a GitHub Organization
- List the repositories and their teams in a GitHub Organization
Hopefully that's enough of a blueprint to help you get any other lists generated.
This tool was pilfered and modified from the following Gist https://gist.github.com/jdennes/11404512
Requirements:
- install bundle via gem (on OS X you'll need
sudo gem install bundle
) - Membership in the organization you'd like to scrape
Installation:
Get set up:
$ git clone https://github.com/pkolyvas/ghost jive-ghost; cd jive-ghost
You'll need to have bundle installed. We're going to use Octokit:
$ bundle install
Configuration
Set environment variables which correspond to your GitHub Access Token and the name of the Organization you wish to scrape.
set -x -g OCTOKIT_ACCESS_TOKEN my_token
set -x -g GHOST_ORG my_org
or if you use bash
export OCTOKIT_ACCESS_TOKEN=my_token
export GHOST_ORG=my_org
User Guide
Then create the default lists:
$ ./scrape.sh
To Do
The most complex script (not that complex but I'm tired) is to produce an array of all the members in an org and then test each repo for membership. There does not appear to be an easier method to do this. I'm not sure if being a member of an org, and not being on the teams themselves, provides access to this dataset.