File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -313,10 +313,26 @@ def get_github_commits(self):
313313 # Get commits
314314 try :
315315 commits = self .repo .get_commits (sha = self .branch )
316+ if commits .totalCount == 0 :
317+ print ('[WARN] No commits found on branch' , self .branch )
318+ message = {}
319+ message ['message' ] = 'Not Found'
320+ message [
321+ 'documentation_url' ] = 'https://docs.github.com/rest/commits/commits#list-commits'
322+ raise github .GithubException .UnknownObjectException (
323+ 404 , message )
316324 return commits
317325 except github .GithubException as e :
318326 if e .status == 404 :
319327 commits = self .repo .get_commits ()
328+ if commits .totalCount == 0 :
329+ print ('[WARN] No commits found on default branch' )
330+ message = {}
331+ message ['message' ] = 'Not Found'
332+ message [
333+ 'documentation_url' ] = 'https://docs.github.com/rest/commits/commits#list-commits'
334+ raise github .GithubException .UnknownObjectException (
335+ 404 , message )
320336 return commits
321337 else :
322338 raise github .GithubException (e .status , e .data )
You can’t perform that action at this time.
0 commit comments