File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed
Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -182,9 +182,13 @@ def get_last_commit_author_if_pr_exists(repo: Repo | None = None) -> str | None:
182182 Return the author's name of the last commit in the current branch if PR_NUMBER is set.
183183 Otherwise, return None.
184184 """
185- if "PR_NUMBER" not in os .environ :
185+ try :
186+ if "PR_NUMBER" not in os .environ :
187+ return None
188+
189+ repository : Repo = repo if repo else git .Repo (search_parent_directories = True )
190+ last_commit = repository .head .commit
191+ return last_commit .author .name
192+ except Exception as e :
193+ logger .exception ("Failed to get last commit author." )
186194 return None
187-
188- repository : Repo = repo if repo else git .Repo (search_parent_directories = True )
189- last_commit = repository .head .commit
190- return last_commit .author .name
You can’t perform that action at this time.
0 commit comments