Created
October 3, 2019 10:30
-
-
Save andrewgribben/53db50be1a452296b85043cd4f74995b to your computer and use it in GitHub Desktop.
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
var labels = []; | |
[].slice.call(document.querySelectorAll(".label-link")) | |
.forEach(function(element) { | |
labels.push({ | |
name: element.textContent.trim(), | |
description: element.parentElement.nextElementSibling.textContent.trim(), | |
// using style.backgroundColor might returns "rgb(...)" | |
color: element.getAttribute("style") | |
.replace("background-color:", "") | |
.replace(/color:.*/,"") | |
.trim() | |
// github wants hex code only without # or ; | |
.replace(/^#/, "") | |
.replace(/;$/, "") | |
.trim(), | |
}) | |
}) | |
let out = "labels:\n"; | |
for (const l of labels){ | |
out += ` - name: ${l.name}\n color: ${l.color}\n description: ${l.description || '""'}\n`; | |
} | |
console.log(out) | |
saveYML(out, "labels.yml") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment