-
Notifications
You must be signed in to change notification settings - Fork 1
/
nvchecker.py
47 lines (43 loc) · 1.22 KB
/
nvchecker.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
#!/usr/bin/env python3
import os
import sys
import json
import giteapy
owner = "imlonghao"
repo = "aur"
configuration = giteapy.Configuration()
configuration.host = "https://git.esd.cc/api/v1"
configuration.api_key["token"] = os.environ["GITEA_BOT_TOKEN"]
api_instance = giteapy.IssueApi(giteapy.ApiClient(configuration))
open_issues = api_instance.issue_list_issues(
owner, repo, state="open", labels="out-of-date", page=-1
)
for line in sys.stdin:
this = json.loads(line)
print(this)
if this["event"] != "updated":
continue
title = "%s: updated from %s to %s" % (
this["name"],
this["old_version"],
this["version"],
)
opened = False
for issue in open_issues:
if issue.title.startswith(this["name"] + ": "):
opened = True
if issue.title != title:
api_instance.issue_edit_issue(
owner, repo, issue.number, body={"title": title}
)
break
if not opened:
api_instance.issue_create_issue(
owner,
repo,
body={
"title": title,
"assignee": "imlonghao",
"labels": [1],
},
)