Closed afuetterer closed 2 months ago
Getting the labels with PyGithub.
import json
from operator import itemgetter
from pprint import pprint
from github import Github
g = Github()
repo = g.get_repo("rdmorganiser/rdmo")
# get all labels from repository
labels = [
{"name": _label.name, "description": _label.description, "color": _label.color}
for _label in repo.get_labels()
]
# remove empty descriptions
for label in labels:
if not label["description"]:
label.pop("description")
# sort by name
labels = sorted(labels, key=itemgetter("name"))
with open("labels.json", "w") as f:
f.write(json.dumps(labels, indent=2))
g.close()
Ref: https://github.com/rdmorganiser/rdmo/labels
"Migrations" label is not needed here.