Skip to content

Instantly share code, notes, and snippets.

@swinton
Last active December 5, 2017 16:46
Show Gist options
  • Save swinton/79a84b17c256940a2821cbdefaf9f069 to your computer and use it in GitHub Desktop.
Save swinton/79a84b17c256940a2821cbdefaf9f069 to your computer and use it in GitHub Desktop.
Exports members of GitHub org as a CSV
#!/bin/bash
#
# Exports members of an org as a CSV
# Usage:
# ./gh-org-members.sh > members.csv
# Dependencies:
# - jq (https://github.com/stedolan/jq)
export GITHUB_TOKEN="[your personal access token]"
export GITHUB_ORG="[your org]"
curl -H "Authorization: token ${GITHUB_TOKEN}" \
https://api.github.com/orgs/${GITHUB_ORG}/members | \
jq -r '.[] | [.login, .url] | @csv'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment