Skip to content

Instantly share code, notes, and snippets.

@alasarr
Created May 28, 2016 10:22
Show Gist options
  • Save alasarr/46624682dcf159e08291b092ffc76452 to your computer and use it in GitHub Desktop.
Save alasarr/46624682dcf159e08291b092ffc76452 to your computer and use it in GitHub Desktop.
GitHub API create label
#!/bin/bash
USER=XXX
ORG=XXX
PASS=XXX
REPO=XXX
# Delete default labels
curl --user "$USER:$PASS" --include --request DELETE "https://api.github.com/repos/$ORG/$REPO/labels/bug"
# curl --user "$USER:$PASS" --include --request DELETE "https://api.github.com/repos/$ORG/$REPO/labels/duplicate"
# curl --user "$USER:$PASS" --include --request DELETE "https://api.github.com/repos/$ORG/$REPO/labels/enhancement"
# curl --user "$USER:$PASS" --include --request DELETE "https://api.github.com/repos/$ORG/$REPO/labels/invalid"
# curl --user "$USER:$PASS" --include --request DELETE "https://api.github.com/repos/$ORG/$REPO/labels/question"
# curl --user "$USER:$PASS" --include --request DELETE "https://api.github.com/repos/$ORG/$REPO/labels/wontfix"
# Create labels
curl --user "$USER:$PASS" --include --request POST --data '{"name":"bug","color":"f99849"}' "https://api.github.com/repos/$ORG/$REPO/labels"
curl --user "$USER:$PASS" --include --request POST --data '{"name":"feature","color":"d4c5f9"}' "https://api.github.com/repos/$ORG/$REPO/labels"
curl --user "$USER:$PASS" --include --request POST --data '{"name":"uix","color":"d4c5f9"}' "https://api.github.com/repos/$ORG/$REPO/labels"
curl --user "$USER:$PASS" --include --request POST --data '{"name":"inprogress","color":"b1ea98"}' "https://api.github.com/repos/$ORG/$REPO/labels"
curl --user "$USER:$PASS" --include --request POST --data '{"name":"inreview","color":"0e8a16"}' "https://api.github.com/repos/$ORG/$REPO/labels"
curl --user "$USER:$PASS" --include --request POST --data '{"name":"priority:inmediate","color":"fc2929"}' "https://api.github.com/repos/$ORG/$REPO/labels"
curl --user "$USER:$PASS" --include --request POST --data '{"name":"priority:high","color":"0052cc"}' "https://api.github.com/repos/$ORG/$REPO/labels"
curl --user "$USER:$PASS" --include --request POST --data '{"name":"priority:medium","color":"6e86a9"}' "https://api.github.com/repos/$ORG/$REPO/labels"
curl --user "$USER:$PASS" --include --request POST --data '{"name":"priority:low","color":"b5c2d9"}' "https://api.github.com/repos/$ORG/$REPO/labels"
curl --user "$USER:$PASS" --include --request POST --data '{"name":"uix","color":"d4c5f9"}' "https://api.github.com/repos/$ORG/$REPO/labels"
curl --user "$USER:$PASS" --include --request POST --data '{"name":"icebox","color":"fbca04"}' "https://api.github.com/repos/$ORG/$REPO/labels"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment