diff --git a/potodo/_github.py b/potodo/_github.py index 27e7387..244b5e1 100644 --- a/potodo/_github.py +++ b/potodo/_github.py @@ -36,12 +36,20 @@ def get_repo_name(repo_path: str) -> str: def get_reservation_list(repo_path: str) -> Mapping[str, str]: """Will get the repository name then request all the issues and put them in a dict """ - # Gets the issues into a dict - issues = requests.get( - "https://api.github.com/repos/" + get_repo_name(repo_path) + "/issues" - ).json() - # Creates the issue dict with the name and the login - reservations: dict = { - issue["title"].split()[-1].lower(): issue["user"]["login"] for issue in issues - } + + issues: list = [] + next = "https://api.github.com/repos/" + get_repo_name() + "/issues?state=open" + while next: + resp = requests.get(next) + issues += issues + next = resp.links.get("next", {}).get("url") + + reservations = {} + + for issue in issues: + # Maybe find a better way for not using python 3.8 ? + if re.search(r'\w*/\w*\.po', issue['title']): + yes = re.search(r'\w*/\w*\.po', issue['title']) + reservations[yes.group()] = issue['user']['login'] + return reservations