Tools for working with GitHub in a large org with many repos.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci
.github
ruby
.gitignore
LICENSE
README.md
list
subscribe
unsubscribe

README.md

GitHub Tools

Tools for working with GitHub in a large org with many repos.

The Tools

“Tools” is maybe an ambitious word; right now these are all “just” scripts:

Tool Description Input (stdin, happy path) Output (stdout, happy path)
list lists the org’s repos: (all, by topic, or those to which you’re subscribed) none list of repos
subscribe subscribes you to a set of repos list of repos none
unsubscribe unsubscribes you from a set of repos list of repos none

Wherein:

  • “you” means the user associated with the supplied GitHub Personal Access Token
  • “subscribe” means change your “watching” status to “watching”
  • “unsubscribe” means change your “watching” status to “not watching”

Requirements

  1. Docker
  2. Bash or a Bash-like shell
  3. An Internet connection
  4. A GitHub Account
  5. A GitHub Personal Access Token

Obtaining a GitHub Personal Access Token

Please see Creating a personal access token for the command line.

We recommend you save your personal access token in your password manager, because GitHub will not show you the token again after it’s been generated.

Using the Tools

Please note: in order to be explicit and to facilitate copying-and-pasting all of the examples below include the required environment variables GITHUB_ORG and GITHUB_TOKEN.

You must replace the placeholder values (REPLACE_ME) with an actual GitHub Organization name and an actual Personal Access Token before running the examples.

In Combination

The tools adhere to the UNIX philosophy as articulated by Doug McIlroy:

Write programs that do one thing and do it well. Write programs to work together. Write programs to handle text streams, because that is a universal interface.

Therefore you can combine many of these tools together using UNIX pipes.

Some Examples

First

This would remove all your (org) subscriptions:

export GITHUB_ORG=REPLACE_ME GITHUB_TOKEN=REPLACE_ME
./list repos --subscribed | tee repos_subscribed.bak | ./unsubscribe

…and this would then restore those subscriptions:

export GITHUB_ORG=REPLACE_ME GITHUB_TOKEN=REPLACE_ME
cat repos_subscribed.bak | ./subscribe
Second

This would subscribe you to all repos with the topic marketplace:

export GITHUB_ORG=REPLACE_ME GITHUB_TOKEN=REPLACE_ME
./list repos --topic marketplace | tee marketplace_repos | ./subscribe

…and this would unsubscribe you from those repos:

export GITHUB_ORG=REPLACE_ME GITHUB_TOKEN=REPLACE_ME
cat marketplace_repos | ./unsubscribe

Individually

List the (Org) Repos that have a Certain Topic

list repos --topic <topic> will output all the repos that belong to the specified organization that have the specified topic.

(Topics are equivalent to tags or labels; same idea, different name.)

export GITHUB_ORG=REPLACE_ME GITHUB_TOKEN=REPLACE_ME
./list repos --topic <topic> | tee repos

List All of the (Org) Repos

list repos --all will output all the repos that belong to the specified organization:

export GITHUB_ORG=REPLACE_ME GITHUB_TOKEN=REPLACE_ME
./list repos --all

List the (Org) Repos to Which You’re Subscribed

list subs will output all the repos that belong to the specified organization to which you’re subscribed:

export GITHUB_ORG=REPLACE_ME GITHUB_TOKEN=REPLACE_ME
./list repos --subscribed | tee repos

Unsubscribing From a Set of (Org) Repos

Assuming the set of repos to which you’d like to unsubscribe is in the local file repos:

export GITHUB_ORG=REPLACE_ME GITHUB_TOKEN=REPLACE_ME
cat repos | ./unsubscribe

Subscribing to a Set of (Org) Repos

Assuming the set of repos to which you’d like to subscribe is in the local file repos:

export GITHUB_ORG=REPLACE_ME GITHUB_TOKEN=REPLACE_ME
cat repos | ./subscribe

Working on the Tools

Running the Tests

ruby/run_all_tests.sh

Copyright & License

Copyright © 2018 Funding Circle Ltd.

Distributed under the BSD 3-Clause License.

Contributing

  • We (Funding Circle) cannot currently accept contributions of code or documentation, but we’re working on it.
  • Any and all feedback — questions, suggestions, bug reports, experience reports, etc — would be greatly appreciated! Please create an issue and one of the maintainers will get back to you shortly.