Skip to content

Instantly share code, notes, and snippets.

@sushihangover
Forked from dlo/update_github_issues.sh
Last active August 29, 2015 14:27
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 sushihangover/fa05be94ce15306a25af to your computer and use it in GitHub Desktop.
Save sushihangover/fa05be94ce15306a25af 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"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment