Based on: https://gist.github.com/cdlhub/02f59220d842b5a32d282f58bd502c11
Which was 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 diff structural",
"color": "6c9b1a",
"description": "Structural changes to repository that are zero-diff"
},
{
"name": "0 diff trivial",
"color": "9dff66",
"description": "The changes in this pull request are trivially zero-diff (documentation, build failure, &c.)"
},
{
"name": "0 diff",
"color": "00ff00",
"description": "The changes in this pull request have verified to be zero-diff with the target branch."
},
{
"name": "Contingent - DNA",
"color": "c14807",
"description": "Do Not Approve (DNA). These changes are contingent on other PRs"
},
{
"name": "Needs Lead Approval",
"color": "d30e5d",
"description": "Change requires science lead approval"
},
{
"name": "Non 0-diff",
"color": "ed1cbf",
"description": "The changes in this pull request are non-zero-diff"
}
].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:
Nice. Probably should spell out DNA in the description.