Labeler es una librería base para cualquier aplicación que requiera colocar etiquetas en github automáticamente.
npm i @lottielabs/labeler
Contribuir: CONTRIBUTING.md
Labeler es una clase con algunos métodos.
constructor(options:labeler_options)
options:
- repo: string
- token: string
Crea la instancia de Labeler.
const labeler = new Labeler({
repo: "owner/repo",
token: "1a2b3c4d3e4f5g6h7i8j9k"
})
.get_label(label_name: string): Promise<label>
label_name: string
@returns: label*
Obtiene una label del repo a partir de su nombre.
const label = await labeler.get_label("bug")
.get_labels(labels_name: string[] | "*"): Promise<label[]>
labels_name: string[] o "*"
@returns: label[]*
Obtiene varias labels del repo usando sus nombres, o todas las labels si se pasa un asterisco como nombre.
const labels = await labeler.get_labels(["bug", "mylabel"])
.add_label(label: label): Promise<void>
label: label*
Añade una label al repositorio.
await labeler.add_label({
name: "custom_label",
color: "ff0000",
description: "Mi label roja"
})
.add_labels(labels: label[]): Promise<void>
label: label[]*
Añade muchas labels al repo.
const labels = [
{
name: "label green",
color: "00ff00",
description: "mi label verde"
},
{
name: "label green",
color: "0000ff",
description: "mi label azul"
}
]
await labeler.add_labels(labels)
.delete_label(label_name: string): Promise<void>
label_name: string
Elimina una label del repo a partir de su nombre.
await labeler.delete_label("label blue")
.delete_labels(labels_name: string[] | "*"): Promise<void>
lables_name: string[] o "*"
Elimina muchas labels según su nombre, o todas las labels si se pasa un asterisco como nombre.
await labeler.delete_labels("*")
type label = {
name: string
color: string
description?: string
}
- Documentar todo el código.
- Escribir el contributing como debe ser.
- Arreglar el manejo de errores horrible de la librería.