Skip to content

Instantly share code, notes, and snippets.

@MrSquaare
Created October 28, 2020 17:27
Show Gist options
  • Save MrSquaare/ac0403c82589b15d24175932968156ce to your computer and use it in GitHub Desktop.
Save MrSquaare/ac0403c82589b15d24175932968156ce to your computer and use it in GitHub Desktop.
Import all labels to a GitHub repository
let input = prompt("JSON labels:")
let labels = JSON.parse(input)
let newLabelForm = document.querySelector("form#new_label")
let newLabelNameInput = document.querySelector("input#label-name-")
let newLabelDescriptionInput = document.querySelector("input#label-description-")
let newLabelColorInput = document.querySelector("input#label-color-")
let newLabelSubmitButton = newLabelForm.querySelector(`button[type="submit"]`)
labels.forEach(label => {
newLabelNameInput.value = label.name
newLabelDescriptionInput.value = label.description
newLabelColorInput.value = label.color
newLabelSubmitButton.disabled = false
newLabelSubmitButton.click()
})
console.log(labels)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment