-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpr-scanner.py
38 lines (33 loc) · 1007 Bytes
/
pr-scanner.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
import os, sys, time, json
from dotenv import load_dotenv
load_dotenv()
from lib.GitHubWrapper import GithubWrapper
from lib.WeaviateWrapper import WeaviateWrapper
import lib.AmicusUtils as utils
from lib.crud import CRUD
gh = GithubWrapper()
wv = WeaviateWrapper()
def main():
# Load the queue
crud = CRUD('queue.json')
# Get the list of owners
owners = utils.get_owners()
# Get the list of repos for each owner
all_repos = utils.get_repos(owners)
# Filter the list of activated repos
activated_repos = utils.filter_repos_to_activated(all_repos)
# Get all pull requests for each repo
prs = utils.get_pull_requests(activated_repos)
# Add prs to the queue
for pr in prs:
if crud.is_pr_in_queue(pr):
continue
crud.add_pull_request(pr)
if __name__ == '__main__':
if len(sys.argv) == 2:
if sys.argv[1] == "--deamon":
while True:
main()
time.sleep(1)
else:
main()