-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
issue_create.py
executable file
·76 lines (62 loc) · 4.23 KB
/
issue_create.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
75
76
#!/usr/bin/python3
"""
Helps massively creating issues
"""
import argparse
def create_issue(sura_name, section_number, riwaya, label, milestone):
"""
Creates an issue on GitHub using the 'gh' command-line tool.
Args:
sura_name (str): Name of the Surah.
section_number (int): Section number within the Surah.
"""
# Format section number with leading zeros for 3 digits
section_number_str = f"{section_number:03d}"
# url to working directory for a specific task
url = "https://github.com/Mchit-W-Jit/QVTonSubjects/tree/dev/"
if riwaya == 'Hafs':
url += f"01%20-%20Hafs%20A'n%20Assem%20-%20حفص%20عن%20عاصم/{label}/{section_number_str}"
#Sleeping 25s to avoid GraphQL: was submitted too quickly (createIssue) error
##Implementaitons
title = f"[Impl.] {sura_name}_{section_number_str}_Audio"
body = f"Please create the audio for [Surah {sura_name}, Section {section_number}]({url})"
#command = ["gh", "issue", "create", "-t", title, "-b", body, "-l", label, "-a @me -m \"{milestone}\""]
#subprocess.run(command, check=True)
print(f"gh issue create -t \"{title}\" -b \"{body}\" -l \"{label},{riwaya},audacity,audio\" -a @me -m \"{milestone}\" ; sleep 25")
title = f"[Impl.] {sura_name}_{section_number_str}_Screenshot"
body = f"Please create the Thumbnail for [Surah {sura_name}, Section {section_number}]({url})"
#command = ["gh", "issue", "create", "-t", title, "-b", body, "-l", label, "-a @me -m \"{milestone}\""]
#subprocess.run(command, check=True)
print(f"gh issue create -t \"{title}\" -b \"{body}\" -l \"{label},{riwaya},thumbnail,screenshot\" -a @me -m \"{milestone}\" ; sleep 25")
title = f"[Impl.] {sura_name}_{section_number_str}_Text"
body = f"Please create the Text for [Surah {sura_name}, Section {section_number}]({url})"
#command = ["gh", "issue", "create", "-t", title, "-b", body, "-l", label, "-a @me -m \"{milestone}\""]
#subprocess.run(command, check=True)
print(f"gh issue create -t \"{title}\" -b \"{body}\" -l \"{label},{riwaya},text\" -a @me -m \"{milestone}\" ; sleep 25")
##Reviews
title = f"[Review] {sura_name}_{section_number_str}_Audio"
body = f"Please review the audio for [Surah {sura_name}, Section {section_number}]({url})"
#command = ["gh", "issue", "create", "-t", title, "-b", body, "-l", label, "-a @me -m \"{milestone}\""]
#subprocess.run(command, check=True)
print(f"gh issue create -t \"{title}\" -b \"{body}\" -l \"{label},{riwaya},audacity,audio\" -a @me -m \"{milestone}\" ; sleep 25")
title = f"[Review] {sura_name}_{section_number_str}_Screenshot"
body = f"Please review the Thumbnail for [Surah {sura_name}, Section {section_number}]({url}) [{sura_name}_{section_number_str}_Screenshot]({url}/{section_number_str}.jpg?raw=true)"
#command = ["gh", "issue", "create", "-t", title, "-b", body, "-l", label, "-a @me -m \"{milestone}\""]
#subprocess.run(command, check=True)
print(f"gh issue create -t \"{title}\" -b \"{body}\" -l \"{label},{riwaya},thumbnail,screenshot\" -a @me -m \"{milestone}\" ; sleep 25")
title = f"[Review] {sura_name}_{section_number_str}_Text"
body = f"Please review the Text for [Surah {sura_name}, Section {section_number}]({url})"
#command = ["gh", "issue", "create", "-t", title, "-b", body, "-l", label, "-a @me -m \"{milestone}\""]
#subprocess.run(command, check=True)
print(f"gh issue create -t \"{title}\" -b \"{body}\" -l \"{label},{riwaya},text\" -a @me -m \"{milestone}\" ; sleep 25")
#print(f"Successfully created issue for Surah {sura_name}, Section {section_number}")
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Create GitHub issues for Quran review")
parser.add_argument("sura_name", help="Name of the Surah")
parser.add_argument("num_sections", type=int, help="Total number of sections in the Surah")
parser.add_argument("riwaya", help="Riwaya to assign to the issues")
parser.add_argument("label", help="label to assign to the issues")
parser.add_argument("milestone", help="milestone to assign to the issues")
args = parser.parse_args()
for sec_num in range(1, args.num_sections + 1):
create_issue(args.sura_name, sec_num, args.riwaya ,args.label,args.milestone)