Skip to content

Instantly share code, notes, and snippets.

@0xferit
Last active March 17, 2021 12:58
Show Gist options
  • Save 0xferit/a204e271f1e4e08c08534a46704a67c8 to your computer and use it in GitHub Desktop.
Save 0xferit/a204e271f1e4e08c08534a46704a67c8 to your computer and use it in GitHub Desktop.
Reset labels of a repo
USER=userOrOrganizationName
REPO=reponame
AUTHORIZATION_TOKEN=authorization-token
#List labels
# curl -H "Authorization: token $AUTHORIZATION_TOKEN" "https://api.github.com/repos/$USER/$REPO/labels" | jq -r '.[].name'
# Delete labels
curl -H "Authorization: token $AUTHORIZATION_TOKEN" "https://api.github.com/repos/$USER/$REPO/labels" | jq -r '.[].name' |jq -Rr @uri | while read name ; do
# echo ${name}
curl -H "Authorization: token $AUTHORIZATION_TOKEN" --request DELETE "https://api.github.com/repos/$USER/$REPO/labels/${name}"
done
#Create labels
curl -H "Authorization: token $AUTHORIZATION_TOKEN" --include --request POST --data '{"name":"duplicate :two:", "description":"Is a duplicate.", "color":"ededed"}' "https://api.github.com/repos/$USER/$REPO/labels"
curl -H "Authorization: token $AUTHORIZATION_TOKEN" --include --request POST --data '{"name":"starter :baby_bottle:", "description":"Good for new contributors.", "color":"ffc0cb"}' "https://api.github.com/repos/$USER/$REPO/labels"
curl -H "Authorization: token $AUTHORIZATION_TOKEN" --include --request POST --data '{"name":"priority: critical :fire:", "description":"Needs to be done asap.", "color":"ee0701"}' "https://api.github.com/repos/$USER/$REPO/labels"
curl -H "Authorization: token $AUTHORIZATION_TOKEN" --include --request POST --data '{"name":"priority: low", "color":"0e8a16"}' "https://api.github.com/repos/$USER/$REPO/labels"
curl -H "Authorization: token $AUTHORIZATION_TOKEN" --include --request POST --data '{"name":"priority: medium", "color":"fbca04"}' "https://api.github.com/repos/$USER/$REPO/labels"
curl -H "Authorization: token $AUTHORIZATION_TOKEN" --include --request POST --data '{"name":"priority: high", "color":"d93f0b"}' "https://api.github.com/repos/$USER/$REPO/labels"
curl -H "Authorization: token $AUTHORIZATION_TOKEN" --include --request POST --data '{"name":"status: abandoned", "description":"The assigned contributor gave up.", "color":"000000"}' "https://api.github.com/repos/$USER/$REPO/labels"
curl -H "Authorization: token $AUTHORIZATION_TOKEN" --include --request POST --data '{"name":"status: available", "description":"Open for anyone to work on.", "color":"c2e0c6"}' "https://api.github.com/repos/$USER/$REPO/labels"
curl -H "Authorization: token $AUTHORIZATION_TOKEN" --include --request POST --data '{"name":"status: blocked", "description":"Blocked by another issue.", "color":"ee0701"}' "https://api.github.com/repos/$USER/$REPO/labels"
curl -H "Authorization: token $AUTHORIZATION_TOKEN" --include --request POST --data '{"name":"status: in progress", "description":"Someone is working on it.", "color":"cccccc"}' "https://api.github.com/repos/$USER/$REPO/labels"
curl -H "Authorization: token $AUTHORIZATION_TOKEN" --include --request POST --data '{"name":"status: on hold", "description":"Purposely paused.", "color":"e99695"}' "https://api.github.com/repos/$USER/$REPO/labels"
curl -H "Authorization: token $AUTHORIZATION_TOKEN" --include --request POST --data '{"name":"status: proposal", "description":"Dont work on it until accepted.", "color":"d4c5f9"}' "https://api.github.com/repos/$USER/$REPO/labels"
curl -H "Authorization: token $AUTHORIZATION_TOKEN" --include --request POST --data '{"name":"status: pending", "description":"Pending reviews.", "color":"fbca04"}' "https://api.github.com/repos/$USER/$REPO/labels"
curl -H "Authorization: token $AUTHORIZATION_TOKEN" --include --request POST --data '{"name":"type: bug :bug:", "color":"ee0701"}' "https://api.github.com/repos/$USER/$REPO/labels"
curl -H "Authorization: token $AUTHORIZATION_TOKEN" --include --request POST --data '{"name":"type: documentation :books:", "color":"5319e7"}' "https://api.github.com/repos/$USER/$REPO/labels"
curl -H "Authorization: token $AUTHORIZATION_TOKEN" --include --request POST --data '{"name":"type: enhancement :sparkles:", "color":"1d76db"}' "https://api.github.com/repos/$USER/$REPO/labels"
curl -H "Authorization: token $AUTHORIZATION_TOKEN" --include --request POST --data '{"name":"type: maintenance :construction:", "description":"Chores.", "color":"fbca04"}' "https://api.github.com/repos/$USER/$REPO/labels"
curl -H "Authorization: token $AUTHORIZATION_TOKEN" --include --request POST --data '{"name":"type: question :grey_question:", "color":"cc317c"}' "https://api.github.com/repos/$USER/$REPO/labels"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment