Last active
June 8, 2025 14:14
-
Star
(155)
You must be signed in to star a gist -
Fork
(33)
You must be signed in to fork a gist
-
-
Save MoOx/93c2853fee760f42d97f to your computer and use it in GitHub Desktop.
Export/import github labels
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 you labels pages | |
// eg https://github.com/cssnext/cssnext/labels | |
// paste this script in your console | |
// copy the output and now you can import it using https://github.com/popomore/github-labels ! | |
var labels = []; | |
[].slice.call(document.querySelectorAll(".label-link")) | |
.forEach(function(element) { | |
labels.push({ | |
name: element.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(), | |
}) | |
}) | |
console.log(JSON.stringify(labels, null, 2)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Install this for your repository : https://probot.github.io/apps/settings/
Go to any repo from where you want to extract the labels
e.g https://github.com/maheshj01/pastelog/issues/labels
paste the below script in the chrome console
below script extracts the labels and generates output in yml format
.github/settings.yaml
and paste the labels copied in step 3sample
settings.yml
for all configurations for this settings refer link in step 1