Skip to content

Instantly share code, notes, and snippets.

@Frikki

Frikki/gh-labels.sh

Last active Jan 28, 2018
Embed
What would you like to do?
Default issue labels for Github repos.
#!/usr/bin/env bash
echo -n "Username: "
read USER
echo -n "Password: "
read -s PASS
echo -n "Repo (e.g., foo/bar): "
read REPO
REPO_USER=$(echo "$REPO" | cut -f1 -d /)
REPO_NAME=$(echo "$REPO" | cut -f2 -d /)
# Delete default labels
curl -u "$USER:$PASS" -i -X DELETE "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels/bug"
curl -u "$USER:$PASS" -i -X DELETE "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels/duplicate"
curl -u "$USER:$PASS" -i -X DELETE "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels/enhancement"
curl -u "$USER:$PASS" -i -X DELETE "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels/help%20wanted"
curl -u "$USER:$PASS" -i -X DELETE "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels/invalid"
curl -u "$USER:$PASS" -i -X DELETE "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels/question"
curl -u "$USER:$PASS" -i -X DELETE "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels/wontfix"
# Create labels
# TYPE
curl -u "$USER:$PASS" -i -X POST -d '{"name": "Feature", "color": "81EB17"}' "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels"
curl -u "$USER:$PASS" -i -X POST -d '{"name": "Bug", "color": "EB1717"}' "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels"
curl -u "$USER:$PASS" -i -X POST -d '{"name": "Duplicate", "color": "EBEB17"}' "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels"
curl -u "$USER:$PASS" -i -X POST -d '{"name": "Upstream Bug", "color": "EB8117"}' "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels"
curl -u "$USER:$PASS" -i -X POST -d '{"name": "Question", "color": "17EB81"}' "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels"
curl -u "$USER:$PASS" -i -X POST -d '{"name": "Expected Behavior", "color": "17EB17"}' "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels"
# PRIORITY
curl -u "$USER:$PASS" -i -X POST -d '{"name": "P1", "color": "339CFF"}' "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels"
curl -u "$USER:$PASS" -i -X POST -d '{"name": "P2", "color": "20629F"}' "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels"
curl -u "$USER:$PASS" -i -X POST -d '{"name": "P3", "color": "133B60"}' "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels"
curl -u "$USER:$PASS" -i -X POST -d '{"name": "P4", "color": "061420"}' "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels"
# SEVERITY
curl -u "$USER:$PASS" -i -X POST -d '{"name": "Blocker", "color": "EB1717"}' "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels"
curl -u "$USER:$PASS" -i -X POST -d '{"name": "Critical", "color": "EB8117"}' "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels"
curl -u "$USER:$PASS" -i -X POST -d '{"name": "High Severity", "color": "EB8117"}' "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels"
curl -u "$USER:$PASS" -i -X POST -d '{"name": "Medium Severity", "color": "F5C08B"}' "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels"
# STATUS
curl -u "$USER:$PASS" -i -X POST -d '{"name": "Cannot Reproduce", "color": "B0D9DF"}' "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels"
curl -u "$USER:$PASS" -i -X POST -d '{"name": "Confirmed", "color": "B0D9DF"}' "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels"
curl -u "$USER:$PASS" -i -X POST -d '{"name": "Fixed: Pending Verification", "color": "D5B0DF"}' "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels"
curl -u "$USER:$PASS" -i -X POST -d '{"name": "Info Needed", "color": "B0D9DF"}' "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels"
curl -u "$USER:$PASS" -i -X POST -d '{"name": "Pending Changes", "color": "B0D9DF"}' "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels"
curl -u "$USER:$PASS" -i -X POST -d '{"name": "Pending Discussion", "color": "B0D9DF"}' "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels"
curl -u "$USER:$PASS" -i -X POST -d '{"name": "Won’t Fix for Now", "color": "B0DFBC"}' "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels"
# TYPE OF CHANGE
curl -u "$USER:$PASS" -i -X POST -d '{"name": "Minor Change", "color": "E9E0E8"}' "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels"
curl -u "$USER:$PASS" -i -X POST -d '{"name": "Medium Change", "color": "BCA1BB"}' "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels"
curl -u "$USER:$PASS" -i -X POST -d '{"name": "Master Change", "color": "90638E"}' "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels"
curl -u "$USER:$PASS" -i -X POST -d '{"name": "Expert Change", "color": "4D054A"}' "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels"
# TEST STATUS
curl -u "$USER:$PASS" -i -X POST -d '{"name": "Lint", "color": "EB8117"}' "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels"
curl -u "$USER:$PASS" -i -X POST -d '{"name": "Tests Passed", "color": "2BB424"}' "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels"
# OTHER
curl -u "$USER:$PASS" -i -X POST -d '{"name": "Awesome", "color": "003BE5"}' "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels"
curl -u "$USER:$PASS" -i -X POST -d '{"name": "Help Wanted", "color": "079D0A"}' "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels"
curl -u "$USER:$PASS" -i -X POST -d '{"name": "Needs Testcase", "color": "EBEB17"}' "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels"
curl -u "$USER:$PASS" -i -X POST -d '{"name": "Regression", "color": "EB1717"}' "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment