Skip to content

Instantly share code, notes, and snippets.

@ariporad
Forked from hubertursua/setup github issues labels.sh
Last active January 31, 2016 18:42
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 ariporad/8ceab6c98958c0bc8f17 to your computer and use it in GitHub Desktop.
Save ariporad/8ceab6c98958c0bc8f17 to your computer and use it in GitHub Desktop.
#!/bin/bash
##
# See https://gist.github.com/ariporad/8ceab6c98958c0bc8f17
##
USER="YOUR_GITHUB_USERNAME"
TOKEN="see git.io/token"
echo -n "GitHub Repo (e.g. foo/bar): "
read REPO
REPO_USER=$(echo "$REPO" | cut -f1 -d /)
REPO_NAME=$(echo "$REPO" | cut -f2 -d /)
deleteLabel() {
curl --user "$USER:$TOKEN" --include --request DELETE "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels/$1"
}
createLabel() {
curl --user "$USER:$TOKEN" --include --request POST --data "{\"name\":\"$1\",\"color\":\"$2\"}" "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels"
}
# Delete default labels
deleteLabel "bug"
deleteLabel "duplicate"
deleteLabel "enhancement"
deleteLabel "help wanted"
deleteLabel "invalid"
deleteLabel "question"
deleteLabel "wontfix"
# Create labels
createLabel "invalid" "ffffff"
createLabel "duplicate" "ffffff"
createLabel "wontfix" "ffffff"
createLabel "chore" "000000"
createLabel "docs" "0052cc"
createLabel "feat" "84b6eb"
createLabel "fix" "fc2929"
createLabel "greenkeeper" "006300"
createLabel "help wanted" "159818"
createLabel "blocked" "aaaaaa"
createLabel "perf" "00A000"
createLabel "question" "cc317c"
createLabel "refactor" "008000"
createLabel "high priority" "FF0000"
createLabel "medium priority" "fbca04"
createLabel "low priority" "aaaaaa"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment