Skip to content

Instantly share code, notes, and snippets.

@do3cc
Created May 20, 2013 11:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save do3cc/5611777 to your computer and use it in GitHub Desktop.
Save do3cc/5611777 to your computer and use it in GitHub Desktop.
This is a template one can use to create notifications for each repo, one ever committed to on github
# In this example, I chose to look into the organizations collective and plone only. Adjust to your needs, don't forget to add yourself, if you want to watch yourself.
# Pagination count is based on the number of repos in collective, which is 919.
# Get all repos from a project
for ORG in collective plone
do
for PAGE in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
do
curl -u $YOURUSER:$YOURPASS -i https://api.github.com/users/$ORG/repos\?page\=$PAGE >> repos
done
done
# Extract repo and owner names for each repo
grep full_name repos | sed -e 's/.*full_name": "\([^"]*\).*/\1/' | sort | uniq > repo_names
# create a file containing only repos to which you committed
for REPO in `cat repo_names`
do
curl -u $YOURUSER:$YOURPASS -i https://api.github.com/repos/$REPO/contributors | egrep "login....$YOURUSER" && echo $repo >> repos_you_touched
done
# Start to watch each repo to which you committed
for REPO in `cat repos_you_touched`
do
curl -u $YOURUSER:$YOURPASS -i -X PUT -d '{"subscribed": true}' https://api.github.com/repos/$REPO/subscription
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment