Based on: https://gist.github.com/Isaddo/7efebcb673a0957b9c6f07cd14826ea4
- Go on your labels page
https://github.com/user/repo/labels
- Paste this script in your console.
- Press Enter.
[
{
"name": "0 - blocker",
"color": "b60205",
"description": "High priority, needs immediate response"
},
{
"name": "1 - urgent",
"color": "d93f0b",
"description": "Urgent priority"
},
{
"name": "2 - normal",
"color": "e99695",
"description": "Normal priority"
},
{
"name": "3 - low",
"color": "f9d0c4",
"description": "Low priority"
},
{
"name": "bug",
"color": "e27461",
"description": "Something isn't working"
},
{
"name": "enhancement",
"color": "fbca04",
"description": "New feature or request"
},
{
"name": "on hold",
"color": "e9e9e9",
"description": "This will be worked on when situation changes"
},
{
"name": "in progress",
"color": "5cc429",
"description": "Someone is working on this"
}
].forEach(function(label) {
addLabel(label)
})
function updateLabel (label) {
var flag = false;
[].slice.call(document.querySelectorAll(".labels-list-item"))
.forEach(function(element) {
if (element.querySelector('.label-link').textContent.trim() === label.name) {
flag = true
element.querySelector('.js-edit-label').click()
element.querySelector('.js-new-label-name-input').value = label.name
element.querySelector('.js-new-label-description-input').value = label.description
element.querySelector('.js-new-label-color-input').value = '#' + label.color
element.querySelector('.js-edit-label-cancel ~ .btn-primary').click()
}
})
return flag
}
function addNewLabel (label) {
document.querySelector('.js-new-label-name-input').value = label.name
document.querySelector('.js-new-label-description-input').value = label.description
document.querySelector('.js-new-label-color-input').value = '#' + label.color
document.querySelector('.js-details-target ~ .btn-primary').disabled = false
document.querySelector('.js-details-target ~ .btn-primary').click()
}
function addLabel (label) {
if (!updateLabel(label)) addNewLabel(label)
}
You'll get the following labels: