Skip to content

Instantly share code, notes, and snippets.

@roylines
Last active January 21, 2016 14:44
Show Gist options
  • Save roylines/25497659692f751150cf to your computer and use it in GitHub Desktop.
Save roylines/25497659692f751150cf to your computer and use it in GitHub Desktop.
Extract github issues into a csv file. Usage: github_issues_to_csv -u USER -t TOKEN -o ORG -r REPO -l LABELS -h HOST
#!/usr/bin/env bash
while [[ $# > 1 ]]
do
key="$1"
case $key in
-u|--user)
USER="$2"
shift # past argument
;;
-t|--token)
TOKEN="$2"
shift # past argument
;;
-o|--org)
ORG="$2"
shift # past argument
;;
-r|--repo)
REPO="$2"
shift # past argument
;;
-l|--labels)
LABELS="$2"
shift # past argument
;;
-h|--HOST)
HOST="$2"
shift # past argument
;;
*)
# unknown option
;;
esac
shift # past argument or value
done
if [ -z "$HOST" ]; then
HOST="https://api.github.com"
fi
curl -u "$USER:$TOKEN" $HOST/repos/$ORG/$REPO/issues\?per_page\=500\&labels\=$LABELS | jq '.[] | [.milestone.title,.id,.title,.state] | @csv' | sed 's/\\//g' | sed 's/"//g'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment