Skip to content

Instantly share code, notes, and snippets.

@Aleyasen
Last active January 28, 2019 09:54
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 Aleyasen/09523f199228fe86da3633e473b955f3 to your computer and use it in GitHub Desktop.
Save Aleyasen/09523f199228fe86da3633e473b955f3 to your computer and use it in GitHub Desktop.
Use Github API to make daily Github administration routines much easier! (especially if you/your company has a lot of repositories)

You need ok.sh (https://github.com/whiteinge/ok.sh) and JQ (http://stedolan.github.io/jq) to use these snippets.

  • Delete a collaborator from all of your repositories (e.g. in case a developer left the company)
ok.sh -j list_repos | jq -r -c '.[] | "\(.full_name)"' | xargs -I % sh -c './ok.sh -y delete_collaborator % [USERNAME]'
  • List all the collaborators for all of your repositories (e.g. to double-check all the repo accesses are legitimate)
ok.sh -j list_repos | jq -r -c '.[] | "\(.full_name)"' | xargs -I % sh -c './ok.sh list_collaborators %' 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment