Skip to content

Instantly share code, notes, and snippets.

@andrewgribben
Created October 3, 2019 10:30
Show Gist options
  • Save andrewgribben/53db50be1a452296b85043cd4f74995b to your computer and use it in GitHub Desktop.
Save andrewgribben/53db50be1a452296b85043cd4f74995b to your computer and use it in GitHub Desktop.
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