Skip to content

Instantly share code, notes, and snippets.

@jzaccone
Last active March 22, 2021 13:49
Show Gist options
  • Save jzaccone/11f7fc69f54bca3aa6b6d499e66bd158 to your computer and use it in GitHub Desktop.
Save jzaccone/11f7fc69f54bca3aa6b6d499e66bd158 to your computer and use it in GitHub Desktop.
Create Zenhub issues based on CSV input. Used to populate issues for DDC conference
from github import Github
from zenhub import Zenhub
import json
import sys
import re
import pandas as pd
from urllib.parse import quote
from datetime import datetime
import csv
git_enterprise_api_endpoint="https://github.ibm.com/api/v3"
zen_enterprise_api_endpoint="https://zenhub.ibm.com"
access_token="XXX"
zen_access_token="XXX"
repo_name="[repo name]"
repo_id = None
firstrow = True
# Create a Github instance
git = Github(base_url=git_enterprise_api_endpoint, login_or_token=access_token)
# Get repo by name
repo = git.get_repo(repo_name)
repo_id = repo.id
print (repo.name)
with open('handson.csv') as csvfile:
reader = csv.reader(csvfile, delimiter=',')
for row in reader:
print (row[8])
body = "- [x] Acceptance sent\n" \
"- [ ] Abstracts/Titles approved\n" \
"- [ ] Headshots received\n" \
"- [ ] Mid-point check-ins\n" \
"- [ ] initial videos uploaded\n" \
"- [ ] videos approved\n" \
"- [ ] powerpoint or pdf\n\n"
body += "Title: " + row[8] \
+ "\n\nSpeaker(s): " + row[1] \
+ "\n\nSpeaker Headshot(s): " \
+ "\n\nSpeaker Emails: " + row[2] \
+ "\n\nAbstract: \n" + row[9] \
+ "\n\nSession Type: " + row[11]
if (row[4]):
body += "\n\nGithub: " + row[4]
if (row[5]):
body += "\n\nTwitter: " + row[5]
body += "\n\nSpeaker Bio: \n" + row[3]
if (row[6]):
body += "\n\nSecond Bio: \n" + row[6]
if (row[7]):
body += "\n\nThird Bio: \n" + row[7]
repo.create_issue(
title="Session: " + row[8],
body=body,
assignees=assignees,
labels=[
repo.get_label("session"),
repo.get_label("track hands-on")
]
)
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment