Detect main branch

Signed-off-by: Aadit Kamat <aadit.k12@gmail.com>
This commit is contained in:
Aadit Kamat
2020-12-27 16:55:38 +08:00
parent abaa2cee2f
commit 96f79dc767

View File

@@ -454,7 +454,12 @@ def get_stats(github):
yearly_data = loc.calculateLoc() yearly_data = loc.calculateLoc()
loc.plotLoc(yearly_data) loc.plotLoc(yearly_data)
stats += '**' + translate['Timeline'] + '**\n\n' stats += '**' + translate['Timeline'] + '**\n\n'
stats = stats + '![Chart not found](https://raw.githubusercontent.com/' + username + '/' + username + '/master/charts/bar_graph.png) \n\n' try:
github.get_repo(f'{username}/{username}').get_branch('main')
branch_name = 'main'
except GithubException:
branch_name = 'master'
stats = stats + '![Chart not found](https://raw.githubusercontent.com/' + username + '/' + username + '/' + branch_name + '/charts/bar_graph.png) \n\n'
return stats return stats