Skip to content

Instantly share code, notes, and snippets.

@Magicking
Created January 30, 2024 09:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Magicking/9ce77bc2fbfe3e5125aecd3441f21cc1 to your computer and use it in GitHub Desktop.
Save Magicking/9ce77bc2fbfe3e5125aecd3441f21cc1 to your computer and use it in GitHub Desktop.
Create issues
#!/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