-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
40 lines (33 loc) · 1.01 KB
/
app.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
import json
from digest_manager import DigestManager
import os
def create_digest_setting():
owner, repo = os.environ["GITHUB_REPOSITORY"].split("/")
with open("digest.setting.json", 'w') as f:
json.dump({
"owner": owner,
"repo": repo,
"target_issue": "",
"ignore_list": []
}, f, indent=4)
if not os.path.exists("./digest.setting.json"):
create_digest_setting()
with open("digest.setting.json", 'r') as f:
try:
setting = json.load(f)
except json.decoder.JSONDecodeError:
create_digest_setting()
with open("digest.setting.json", 'r') as f:
setting = json.load(f)
ql = DigestManager(
setting["owner"],
setting["repo"],
setting["target_issue"],
ignore_numbers=setting["ignore_list"]
)
issues = ql.get_result()
ql.send_data(issues)
setting["target_issue"] = ql.target_issue
setting["ignore_list"] = ql.ignore_numbers
with open("digest.setting.json", 'w') as f:
json.dump(setting, f, indent=4)