Skip to content

Instantly share code, notes, and snippets.

@wescleymatos
Forked from dysfunc/IMPORT-GITHUB-LABELS.md
Last active May 17, 2024 19:22
Show Gist options
  • Save wescleymatos/11c897e855cca886eb36b5e37f08ee9e to your computer and use it in GitHub Desktop.
Save wescleymatos/11c897e855cca886eb36b5e37f08ee9e to your computer and use it in GitHub Desktop.
Importing labels collection into GitHub Repo

Useful labeling system used in all my repositories.

const labels = [
  {
    "name": "Category: Arch",
    "description": "",
    "color": "808080"
  },
  {
    "name": "Category: Backend",
    "description": "",
    "color": "ffffff"
  },
  {
    "name": "Category: Database",
    "description": "",
    "color": "f0e68c"
  },
  {
    "name": "Category: Documentation",
    "description": "",
    "color": "e6e6fa"
  },
  {
    "name": "Category: Frontend",
    "description": "",
    "color": "5843ad"
  },
  {
    "name": "Category: Infra / DevOps",
    "description": "",
    "color": "fef2c0"
  },
  {
    "name": "Category: QA",
    "description": "",
    "color": "ededed"
  },
  {
    "name": "Status: Blocked",
    "description": "",
    "color": "D93F0B"
  },
  {
    "name": "Type: Bug",
    "description": "",
    "color": "B60205"
  },
  {
    "name": "Type: Improvement",
    "description": "",
    "color": "0000ff"
  },
  {
    "name": "Type: New feature",
    "description": "",
    "color": "71D13A"
  },
  {
    "name": "Type: Task",
    "description": "",
    "color": "d1d100"
  },
  {
    "name": "Type: Technical debt",
    "description": "",
    "color": "0E1253"
  }
]

const name = document.getElementById('label-name-');
const description = document.getElementById('label-description-');
const color = document.getElementById('label-color-');
const submit = document.querySelector('.js-label-form .btn.btn-primary');

labels.forEach((label) => addNewLabel(label));

function addNewLabel (label) {
  name.value = label.name;
  description.value = label.description;
  color.value = '#' + label.color;
  submit.removeAttribute('disabled');
  submit.click();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment