Skip to content

Instantly share code, notes, and snippets.

@vnegrisolo
Last active September 3, 2016 14:53
Show Gist options
  • Save vnegrisolo/5d082f4880232b03e586 to your computer and use it in GitHub Desktop.
Save vnegrisolo/5d082f4880232b03e586 to your computer and use it in GitHub Desktop.
Add github labels to my repos
#!/bin/bash
read -p $'Github \e[31musername\e[0m: ' user
echo -n $'Github \e[31mpassword\e[0m: '
read -s pass
echo ''
read -p $'Repository \e[31mowner\e[0m: ' owner
read -p $'The \e[31mrepository\e[0m: ' repo
function add_label {
label=${1}
color=${2}
data="{\"name\":\"${label}\", \"color\":\"${color}\"}"
url="https://api.github.com/repos/${owner}/${repo}/labels"
CURL_OUTPUT=$(curl -s -u "${user}:${pass}" -X POST "${url}" -d "${data}")
# CURL_OUTPUT=$(curl -s -u "${user}:${pass}" -X PATCH "${url}/${label}" -d "${data}")
echo "result for ${label} = ${CURL_OUTPUT}"
}
# Platform
add_label 'javascript' 'BFD4F2'
add_label 'html-css' 'BFD4F2'
add_label 'web-app' 'BFD4F2'
add_label 'admin-app' 'BFD4F2'
add_label 'mobile-app' 'BFD4F2'
# Environment
add_label 'staging' '5319E7'
# Type
add_label 'feature' '5EBEFF'
add_label 'technical-debt' '5EBEFF'
add_label 'upgrade-version' '5EBEFF'
add_label 'performance' '5EBEFF'
add_label 'design-ux' '5EBEFF'
# Workflow
add_label 'in-progress' 'FBCA04'
add_label 'in-review' '91CA55'
add_label 'blocked' '000000'
# Problems
add_label 'bug' 'EE3F46'
add_label 'security' 'EE3F46'
# Feedback
add_label 'question' 'CC317C'
# Inactive
add_label 'invalid' 'D2DAE1'
add_label 'wontfix' 'D2DAE1'
add_label 'duplicate' 'D2DAE1'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment