Created
January 30, 2024 09:46
-
-
Save Magicking/9ce77bc2fbfe3e5125aecd3441f21cc1 to your computer and use it in GitHub Desktop.
Create issues
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import random | |
import csv | |
from github import Github | |
# Authentication is defined via github.Auth | |
from github import Auth | |
# using an access token | |
auth = Auth.Token("YOUTOKEN") | |
def generate_random_hex_color(): | |
return "{:06x}".format(random.randint(0, 0xFFFFFF)) | |
# Public Web Github | |
g = Github(auth=auth) | |
repo = g.get_repo("usual-dao/pegasus") | |
reader = csv.reader(open("/tmp/Untitled spreadsheet - Sheet1.csv", "r")) | |
i = 0 | |
for row in reader: | |
#if i < 50: | |
# i+=1 | |
# continue | |
labels = set([x.name for x in repo.get_labels()]) | |
title = row[0].strip() | |
if len(title) == 0: continue | |
label = "bs-audit-" + row[1].strip().lower() | |
if label not in labels: | |
repo.create_label(name=label, color=generate_random_hex_color()) | |
desc = row[2].strip() | |
reco = row[3].strip() | |
print("%d: Title: %s" % (i, title)) | |
print("%d: Label: %s" % (i, label)) | |
print("%d: Desc: %s" % (i, desc)) | |
print("%d: Reco: %s" % (i, reco)) | |
repo.create_issue(title=title, labels=['bs-audit', label], body="%s\n# Recommendations\n%s" % (desc, reco)) | |
i+=1 | |
#for col in row: | |
# print(col) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment