Skip to content

Instantly share code, notes, and snippets.

@dlo
Last active December 12, 2015 10:39
Show Gist options
  • Save dlo/4760637 to your computer and use it in GitHub Desktop.
Save dlo/4760637 to your computer and use it in GitHub Desktop.
Make the default GitHub issue labels a little nicer.
function getpassword() {
# Written for Mac OS X Keychain.
SERVICE=$1
ACCOUNT=$2
security find-internet-password -s $SERVICE -a $ACCOUNT -w | tr -d '\n'
}
function update_github_issues() {
read -p "Enter the repo owner: " OWNER
read -p "Enter the repo name: " REPO
GITHUB_ACCESS_TOKEN=`getpassword "api.github.com" "GitHub"`
ENDPOINT="https://api.github.com/repos/$OWNER/$REPO/labels"
# Add New Labels
curl -X POST -d '{"name": "tweak", "color": "5fb3fc"}' $ENDPOINT?access_token=$GITHUB_ACCESS_TOKEN
curl -X POST -d '{"name": "needs more info", "color": "575473"}' $ENDPOINT?access_token=$GITHUB_ACCESS_TOKEN
# Delete Labels We Won't Use
curl -X DELETE $ENDPOINT/invalid?access_token=$GITHUB_ACCESS_TOKEN
curl -X DELETE $ENDPOINT/wontfix?access_token=$GITHUB_ACCESS_TOKEN
# Update Colors For Existing Labels
curl -X PATCH -d '{"name": "tweak", "color": "5fb3fc"}' $ENDPOINT/tweak?access_token=$GITHUB_ACCESS_TOKEN
curl -X PATCH -d '{"name": "needs more info", "color": "575473"}' "$ENDPOINT/needs%20more%20info?access_token=$GITHUB_ACCESS_TOKEN"
curl -X PATCH -d '{"name": "enhancement", "color": "1a97fc"}' $ENDPOINT/enhancement?access_token=$GITHUB_ACCESS_TOKEN
curl -X PATCH -d '{"name": "question", "color": "f9d29d"}' $ENDPOINT/question?access_token=$GITHUB_ACCESS_TOKEN
curl -X PATCH -d '{"name": "bug", "color": "f8579a"}' $ENDPOINT/bug?access_token=$GITHUB_ACCESS_TOKEN
curl -X PATCH -d '{"name": "duplicate", "color": "575473"}' "$ENDPOINT/duplicate?access_token=$GITHUB_ACCESS_TOKEN"
}
@potench
Copy link

potench commented Feb 12, 2013

:trollface:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment