Last active
January 21, 2016 14:44
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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