From cb5d79fc1d7601f5ff674fbd803fe5ec2efa0f6a Mon Sep 17 00:00:00 2001 From: Pun Butrach Date: Mon, 15 Jan 2024 20:07:24 +0700 Subject: [PATCH] Surround `commits` under try-except block (#3974) * Surround `commits` under try-except block * Directly return instead of setting variable to 0 * Update ci.py --- ci.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ci.py b/ci.py index bdfd624eda..36004a1801 100644 --- a/ci.py +++ b/ci.py @@ -45,8 +45,12 @@ def send_artifact_to_telegram_chat(chat_id): def send_internal_notifications(): repository = git.Repo(".") commit_range = f"{github_event_before}...{github_sha}" - commits = list(repository.iter_commits(commit_range)) - + try: + commits = list(repository.iter_commits(commit_range)) + except git.exc.GitCommandError as error: + print(f"Error fetching commits: {error}") + return + if len(commits) == 0: return overview_link = f"https://github.com/{github_repository}/compare/{commit_range}"