-
Notifications
You must be signed in to change notification settings - Fork 404
/
report_issue.py
executable file
·74 lines (51 loc) · 1.52 KB
/
report_issue.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/usr/bin/env python
import os
import sys
from getpass import getpass
from github3 import login
try:
import readline
readline.parse_and_bind("tab: complete")
except ImportError:
pass
def prompt_user(prompt_str):
return input(prompt_str).strip() or prompt_user(prompt_str)
if len(sys.argv) > 1 and sys.argv[1] in ("-h", "--help", "-?"):
print(f"Usage: {sys.argv[0]} [-h|-?|--help]")
print("Simple issue reporting script for github3.py\n")
print("If you're reporting a bug, please save a traceback to a file")
print("and supply the filename when filing the bug report. Please be")
print("as descriptive as possible.\n\n")
print(" -h, -?, --help Print this message and exit")
sys.exit(0)
username = ""
password = ""
username = prompt_user("Enter GitHub username: ")
while not password:
password = getpass(f"Password for {username}: ")
g = login(username, password)
repo = g.repository("sigmavirus24", "github3.py")
title = prompt_user("Title/summary: ")
issue_type = prompt_user("Bug or feature request? ")
traceback = None
if issue_type.lower() == "bug":
tb_file = prompt_user("Filename with traceback: ")
if os.path.isfile(tb_file):
traceback = open(tb_file).read()
description = prompt_user("Description: ")
body = """**Issue type**: {}
------
**Traceback**:
```
{}
```
------
**Description**:
{}
------
*Generated with github3.py using the report_issue script*
""".format(
issue_type, traceback, description
)
i = repo.create_issue(title, body)
print(i.html_url)