Fix error in get_main_pr_languages when the diff is empty

This can happen for example when you have one commit add a line to a file and the next commit deletes that line. Then if those are the only 2 commits in the PR the diff will be empty.
This commit is contained in:
Zohar Meir
2023-11-02 10:10:54 +02:00
committed by GitHub
parent ce64877063
commit 15573e2286

View File

@ -143,6 +143,9 @@ def get_main_pr_language(languages, files) -> str:
if not languages:
get_logger().info("No languages detected")
return main_language_str
if not files:
get_logger().info("No files in diff")
return main_language_str
try:
top_language = max(languages, key=languages.get).lower()