Surround commits under try-except block (#3974)

* Surround `commits` under try-except block

* Directly return instead of setting variable to 0

* Update ci.py
This commit is contained in:
Pun Butrach
2024-01-15 20:07:24 +07:00
committed by GitHub
parent 512606ee09
commit cb5d79fc1d

8
ci.py
View File

@@ -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}"