From 24a88b41a5a8bf34f27a9bcc0b767c921729fdb0 Mon Sep 17 00:00:00 2001 From: Zack Koppert Date: Thu, 5 Oct 2023 16:26:40 -0700 Subject: [PATCH] Allow for no date constraints Signed-off-by: Zack Koppert --- commits.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/commits.py b/commits.py index 89d42ca..4cbf2bb 100644 --- a/commits.py +++ b/commits.py @@ -6,7 +6,11 @@ def get_commits( author: str, repo: object, github_connection: object, start_date: str, end_date: str ) -> github3.search.commit.CommitSearchResult: """Get commit information for a single author from the repository""" + search_dates = "" + if start_date and end_date: + search_dates = f" committer-date:{start_date}..{end_date}" + commits = github_connection.search_commits( - f"repo:{repo.full_name} author:{author} merge:false committer-date:{start_date}..{end_date}" + f"repo:{repo.full_name} author:{author} merge:false {search_dates}" ) return commits