diff --git a/todoist_github/cli.py b/todoist_github/cli.py index b3bba8f..97b75d2 100755 --- a/todoist_github/cli.py +++ b/todoist_github/cli.py @@ -60,7 +60,10 @@ def main(): for task in todoist_tasks.values(): if not is_task_completed(task) or task["id"] in tasks_actioned: continue - org, repo, issue_number = get_github_issue_details(task["content"]) + issue_details = get_github_issue_details(task["content"]) + if not issue_details: + continue + org, repo, issue_number = issue_details issue = get_issue(me, org, repo, issue_number) me_assigned = me.login in {assignee.login for assignee in issue.assignees} if not me_assigned: diff --git a/todoist_github/utils.py b/todoist_github/utils.py index 27aa207..ff5c412 100644 --- a/todoist_github/utils.py +++ b/todoist_github/utils.py @@ -19,6 +19,7 @@ def get_github_task(content) -> Optional[str]: parsed_url.path ): return url + return None def get_github_issue_details(content): @@ -27,6 +28,8 @@ def get_github_issue_details(content): return parsed_url = urlparse(url) match = GITHUB_ISSUE_PR_RE.search(parsed_url.path) + if not match: + return return match.group(1), match.group(2), match.group(4)