-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsubmit.py
37 lines (31 loc) · 945 Bytes
/
submit.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import sys
import os
try:
from configparser import ConfigParser
except ImportError:
from ConfigParser import ConfigParser # ver. < 3.0
try:
import github
except ImportError:
sys.exit("ImportError: PyGithub not installed. Install it with \'pip install PyGithub\'")
config = ConfigParser()
config.read('config.ini')
g = github.Github(config['config'].get('accesskey'))
# g = Github(os.environ['GITHUB_API_KEY'])
try:
repo = g.get_repo(config['config'].get('repo'))
except:
sys.exit("ConfigError: An attribute is invalid.")
# Issue creating process
title = input("Enter the title of the issue: ")
body = input("Describe the issue: ")
if (body == ""):
body = github.GithubObject.NotSet
repo.create_issue(
title = title,
body = body,
assignee = github.GithubObject.NotSet,
milestone = github.GithubObject.NotSet,
labels = github.GithubObject.NotSet,
assignees = github.GithubObject.NotSet,
)