Skip to content

Instantly share code, notes, and snippets.

@bonelifer
Forked from camilleriluke/repo-labels.sh
Created September 3, 2020 19:11
Show Gist options
  • Save bonelifer/c3a3774248089fef54ef516548e19584 to your computer and use it in GitHub Desktop.
Save bonelifer/c3a3774248089fef54ef516548e19584 to your computer and use it in GitHub Desktop.
Github repository labels standard
#!/usr/bin/env bash
# You can craete a token from https://github.com/settings/tokens and give the
# "repo" persmission to the token
AUTH_TOKEN=$1
OWNERREPO=$2
if [[ "$#" -ne 2 ]]; then
echo "Usage: $0 AUTH_TOKEN OWNER/REPO\n"
exit 1
fi
echo "Updating labels for repository https://github.com/$OWNERREPO/labels"
echo "Removing default labels"
curl --request DELETE -H "Authorization: token $AUTH_TOKEN" "https://api.github.com/repos/$OWNERREPO/labels/help%20wanted"
curl --request DELETE -H "Authorization: token $AUTH_TOKEN" "https://api.github.com/repos/$OWNERREPO/labels/good%20first%20issue"
curl --request DELETE -H "Authorization: token $AUTH_TOKEN" https://api.github.com/repos/$OWNERREPO/labels/documentation
curl --request DELETE -H "Authorization: token $AUTH_TOKEN" https://api.github.com/repos/$OWNERREPO/labels/bug
curl --request DELETE -H "Authorization: token $AUTH_TOKEN" https://api.github.com/repos/$OWNERREPO/labels/duplicate
curl --request DELETE -H "Authorization: token $AUTH_TOKEN" https://api.github.com/repos/$OWNERREPO/labels/enhancement
curl --request DELETE -H "Authorization: token $AUTH_TOKEN" https://api.github.com/repos/$OWNERREPO/labels/invalid
curl --request DELETE -H "Authorization: token $AUTH_TOKEN" https://api.github.com/repos/$OWNERREPO/labels/question
curl --request DELETE -H "Authorization: token $AUTH_TOKEN" https://api.github.com/repos/$OWNERREPO/labels/wontfix
echo "Adding new labels"
curl --request POST --data '{"name": "Priority: Critical", "color": "d93f0b"}' -H "Authorization: token $AUTH_TOKEN" https://api.github.com/repos/$OWNERREPO/labels
curl --request POST --data '{"name": "Priority: Low", "color": "efefef"}' -H "Authorization: token $AUTH_TOKEN" https://api.github.com/repos/$OWNERREPO/labels
curl --request POST --data '{"name": "Priority: Medium", "color": "fbca04"}' -H "Authorization: token $AUTH_TOKEN" https://api.github.com/repos/$OWNERREPO/labels
curl --request POST --data '{"name": "Status: On Hold", "color": "fef2c0"}' -H "Authorization: token $AUTH_TOKEN" https://api.github.com/repos/$OWNERREPO/labels
curl --request POST --data '{"name": "Status: Review Needed", "color": "c5def5"}' -H "Authorization: token $AUTH_TOKEN" https://api.github.com/repos/$OWNERREPO/labels
curl --request POST --data '{"name": "Status: WIP", "color": "ff6dbb"}' -H "Authorization: token $AUTH_TOKEN" https://api.github.com/repos/$OWNERREPO/labels
curl --request POST --data '{"name": "Status: 🛳🇮🇹", "color": "c2e0c6"}' -H "Authorization: token $AUTH_TOKEN" https://api.github.com/repos/$OWNERREPO/labels
curl --request POST --data '{"name": "Type: Bug", "color": "d4c5f9"}' -H "Authorization: token $AUTH_TOKEN" https://api.github.com/repos/$OWNERREPO/labels
curl --request POST --data '{"name": "Type: New functionality", "color": "47f770"}' -H "Authorization: token $AUTH_TOKEN" https://api.github.com/repos/$OWNERREPO/labels
curl --request POST --data '{"name": "Type: Refactoring", "color": "bd25c4"}' -H "Authorization: token $AUTH_TOKEN" https://api.github.com/repos/$OWNERREPO/labels
curl --request POST --data '{"name": "Type: Maintenance", "color": "5319e7"}' -H "Authorization: token $AUTH_TOKEN" https://api.github.com/repos/$OWNERREPO/labels
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment