Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import github labels via console command (my personal label colors)
/*
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": "⬇",
"color": "e8bc74"
},
{
"name": "⬆",
"color": "d6e900"
},
{
"name": "★",
"color": "eeef00"
},
{
"name": "dev",
"color": "5c89a6"
},
{
"name": "revision",
"color": "e2674a"
},
{
"name": "critical",
"color": "d64068"
},
{
"name": "vendor-bug",
"color": "b60205"
},
{
"name": "performance",
"color": "5d78f4"
},
{
"name": "stability",
"color": "d93f0b"
},
{
"name": "security",
"color": "5f688f"
},
{
"name": "warning",
"color": "fbca04"
},
{
"name": "todo",
"color": "fbca04"
},
{
"name": "documentation",
"color": "7f7eac"
},
{
"name": "feature",
"color": "1d76db"
},
{
"name": "typescript",
"color": "aa6fce"
},
{
"name": "bug",
"color": "ee0701"
},
{
"name": "duplicate",
"color": "d3e0ed"
},
{
"name": "enhancement",
"color": "3d91c8"
},
{
"name": "help wanted",
"color": "1c948b"
},
{
"name": "invalid",
"color": "e0eaf2"
},
{
"name": "question",
"color": "cc317c"
},
{
"name": "wontfix",
"color": "f1f5f4"
},
{
"name": "gui",
"color": "9c60df"
},
{
"name": "ux",
"color": "5319e7"
},
{
"name": "windows",
"color": "1caed7"
},
{
"name": "mac",
"color": "39b36f"
},
{
"name": "chrome",
"color": "4eaa65"
},
{
"name": "safari",
"color": "4e99aa"
},
{
"name": "firefox",
"color": "b87a69"
},
{
"name": "edge",
"color": "4e99dc"
},
{
"name": "ie",
"color": "4e90ca"
},
{
"name": "simulator",
"color": "64ddea"
},
{
"name": "device",
"color": "f29f1a"
}
].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-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-color-input').value = '#' + label.color
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
You can’t perform that action at this time.