-
-
Save jkfran/341ac9fecec621187938a1e709ec233d to your computer and use it in GitHub Desktop.
import github labels via console command
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Go on your labels page (https://github.com/user/repo/labels) | |
Edit the following label array | |
or | |
Use this snippet to export github labels (https://gist.github.com/MoOx/93c2853fee760f42d97f) | |
and replace it | |
Paste this script in your console | |
Press Enter!! | |
*/ | |
[ | |
{ | |
"name": "Blocked ⛔", | |
"description": null, | |
"color": "c7162b" | |
}, | |
{ | |
"name": "Brand", | |
"description": null, | |
"color": "e95420" | |
}, | |
{ | |
"name": "Breaking change", | |
"description": null, | |
"color": "c7162b" | |
}, | |
{ | |
"name": "Bug", | |
"description": null, | |
"color": "c7162b" | |
}, | |
{ | |
"name": "Copy update", | |
"description": null, | |
"color": "a9f9f1" | |
}, | |
{ | |
"name": "Declined", | |
"description": null, | |
"color": "333333" | |
}, | |
{ | |
"name": "dependencies", | |
"description": "Pull requests that update a dependency file", | |
"color": "0366d6" | |
}, | |
{ | |
"name": "Docs", | |
"description": "Issues related to the site's documentation", | |
"color": "a9f9f1" | |
}, | |
{ | |
"name": "Don't merge", | |
"description": null, | |
"color": "c7162b" | |
}, | |
{ | |
"name": "Epic", | |
"description": null, | |
"color": "335280" | |
}, | |
{ | |
"name": "Feature", | |
"description": null, | |
"color": "a9f9f1" | |
}, | |
{ | |
"name": "Good first issue", | |
"description": null, | |
"color": "007aa6" | |
}, | |
{ | |
"name": "Help wanted", | |
"description": null, | |
"color": "a9f9f1" | |
}, | |
{ | |
"name": "Invalid", | |
"description": null, | |
"color": "ffffff" | |
}, | |
{ | |
"name": "Maintenance", | |
"description": null, | |
"color": "a9f9f1" | |
}, | |
{ | |
"name": "Master Epic", | |
"description": null, | |
"color": "f99b11" | |
}, | |
{ | |
"name": "Performance", | |
"description": null, | |
"color": "d96ae8" | |
}, | |
{ | |
"name": "Priority: Critical", | |
"description": null, | |
"color": "c7162b" | |
}, | |
{ | |
"name": "Priority: High", | |
"description": null, | |
"color": "f5b041" | |
}, | |
{ | |
"name": "Priority: Low", | |
"description": null, | |
"color": "fff6cf" | |
}, | |
{ | |
"name": "Priority: Medium", | |
"description": null, | |
"color": "f7dc6f" | |
}, | |
{ | |
"name": "Project", | |
"description": null, | |
"color": "772953" | |
}, | |
{ | |
"name": "Question", | |
"description": null, | |
"color": "007aa6" | |
}, | |
{ | |
"name": "Released", | |
"description": null, | |
"color": "7f33b2" | |
}, | |
{ | |
"name": "Review: Code -1", | |
"description": null, | |
"color": "c7162b" | |
}, | |
{ | |
"name": "Review: Code needed", | |
"description": null, | |
"color": "cdcdcd" | |
}, | |
{ | |
"name": "Review: Code +1", | |
"description": null, | |
"color": "0e8420" | |
}, | |
{ | |
"name": "Review: Design -1", | |
"description": null, | |
"color": "c7162b" | |
}, | |
{ | |
"name": "Review: QA -1", | |
"description": null, | |
"color": "c7162b" | |
}, | |
{ | |
"name": "Review: QA needed", | |
"description": null, | |
"color": "cdcdcd" | |
}, | |
{ | |
"name": "Review: Design needed", | |
"description": null, | |
"color": "cdcdcd" | |
}, | |
{ | |
"name": "Review: QA +1", | |
"description": null, | |
"color": "0e8420" | |
}, | |
{ | |
"name": "Review: Design +1", | |
"description": null, | |
"color": "0e8420" | |
} | |
].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) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment