Skip to content

Commit

Permalink
Fix GitHub regressions in ojacques#69
Browse files Browse the repository at this point in the history
Error message:

        'avatar': commit['author']['avatar_url'] if user['avatar_url'] is not None else ''
    UnboundLocalError: local variable 'user' referenced before assignment

Ref: ojacques#69
  • Loading branch information
j3soon committed Oct 4, 2024
1 parent 33d54e6 commit 38df7d2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions mkdocs_git_committers_plugin_2/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,13 @@ def get_contributors_to_file(self, path, submodule_repo=None):
authors.append({'login': commit['author']['login'],
'name': commit['author']['login'],
'url': commit['author']['html_url'],
'avatar': commit['author']['avatar_url'] if user['avatar_url'] is not None else ''
'avatar': commit['author']['avatar_url']
})
if commit['committer'] and commit['committer']['login'] and commit['committer']['login'] not in [author['login'] for author in authors]:
authors.append({'login': commit['committer']['login'],
'name': commit['committer']['login'],
'url': commit['committer']['html_url'],
'avatar': commit['committer']['avatar_url'] if user['avatar_url'] is not None else ''
'avatar': commit['committer']['avatar_url']
})
if commit['commit'] and commit['commit']['message'] and '\nCo-authored-by:' in commit['commit']['message']:
github_coauthors_exist = True
Expand All @@ -138,7 +138,7 @@ def get_contributors_to_file(self, path, submodule_repo=None):
authors.append({'login': self.gitlabauthors_cache[commit['author_name']]['username'],
'name': commit['author_name'],
'url': self.gitlabauthors_cache[commit['author_name']]['web_url'],
'avatar': self.gitlabauthors_cache[commit['author_name']]['avatar_url'] if user['avatar_url'] is not None else ''
'avatar': self.gitlabauthors_cache[commit['author_name']]['avatar_url']
})
else:
# Fetch author from GitLab API
Expand Down

0 comments on commit 38df7d2

Please sign in to comment.