Skip to content

Instantly share code, notes, and snippets.

@joerx
Last active August 24, 2018 06:49
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 joerx/254a861659bfac86197a73eeb9f3ea29 to your computer and use it in GitHub Desktop.
Save joerx/254a861659bfac86197a73eeb9f3ea29 to your computer and use it in GitHub Desktop.
Delete member from all Github team memberships. Careful with this!
curl -H "Authorization: token $GITHUB_TOKEN" https://api.github.com/user/teams | jq -r '.[] | [.organization.name, .name, (.id|tostring)] | join("|")' | grep -v $DONT_DELETE_FROM_THIS | awk -F '|' '{ print "https://api.github.com/teams/" $3 "/memberships/$USERNAME" }' | xargs -I {} curl -H"Authorization: token $GITHUB_TOKEN" -XDELETE {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment