Closed Remi-Gau closed 1 year ago
labels_export = [
{
"name": "Flag: desc wanted",
"description": "This issue needs more context",
"color": "d93f0b"
}
]
labels_export.forEach(function(label) {
addLabel(label)
})
function updateLabel (label) {
var flag = false;
[].slice.call(document.querySelectorAll(".js-labels-list-item"))
.forEach(function(element) {
if (element.querySelector('.js-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-new-label-description-input').value = label.description
element.querySelector('.js-edit-label-cancel ~ .btn-primary').disabled = false
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-new-label-description-input').value = label.description
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)
}
labels_export
with the json containing info - of the new labelsThis did not work. Need to reimport.
need to use query parameters to grab all labels:
curl "https://api.github.com/repos/brainhackorg/global2021/labels?per_page=100&page=1"
https://docs.github.com/en/rest/issues/labels#list-labels-for-a-repository
get all labels from last year: