Created
March 31, 2020 12:27
-
-
Save krenor/04aae92db10ff768426697be1c7a7939 to your computer and use it in GitHub Desktop.
Create custom labels
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo '\nThis script will remove the GitHub default labels and create customized labels for your repo. | |
A personal access token is required to access private repos.' | |
echo '\nGitHub Personal Access Token: ' | |
read -s TOKEN | |
echo '' | |
echo 'GitHub Org/Repo (e.g. foo/bar): ' | |
read REPO | |
REPO_USER=$(echo "$REPO" | cut -f1 -d /) | |
REPO_NAME=$(echo "$REPO" | cut -f2 -d /) | |
# Delete default labels | |
http --auth $TOKEN:x-oauth-basic DELETE "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels/bug" | |
http --auth $TOKEN:x-oauth-basic DELETE "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels/duplicate" | |
http --auth $TOKEN:x-oauth-basic DELETE "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels/enhancement" | |
http --auth $TOKEN:x-oauth-basic DELETE "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels/good first issue" | |
http --auth $TOKEN:x-oauth-basic DELETE "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels/help wanted" | |
http --auth $TOKEN:x-oauth-basic DELETE "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels/invalid" | |
http --auth $TOKEN:x-oauth-basic DELETE "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels/question" | |
http --auth $TOKEN:x-oauth-basic DELETE "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels/wontfix" | |
# Create own labels | |
echo '{"name":"bug","color":"EE3F46"}' | http --auth $TOKEN:x-oauth-basic "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels" | |
echo '{"name":"chore","color":"FEF2C0"}' | http --auth $TOKEN:x-oauth-basic "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels" | |
echo '{"name":"discussion","color":"CC317C"}' | http --auth $TOKEN:x-oauth-basic "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels" | |
echo '{"name":"enhancement","color":"5EBEFF"}'| http --auth $TOKEN:x-oauth-basic "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels" | |
echo '{"name":"feature","color":"91CA55"}' | http --auth $TOKEN:x-oauth-basic "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels" | |
echo '{"name":"inactive","color":"D2DAE1"}' | http --auth $TOKEN:x-oauth-basic "https://api.github.com/repos/$REPO_USER/$REPO_NAME/labels" | |
echo '{"name":"pending","color":"FBCA04"}' | http --auth $TOKEN:x-oauth-basic "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