Skip to content

Commit

Permalink
add insights script
Browse files Browse the repository at this point in the history
  • Loading branch information
renan028 committed May 28, 2020
1 parent cd633c4 commit 0c37279
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
5 changes: 5 additions & 0 deletions 2020-05-28.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
,MIRON-Components,MIRON-Systems,DomainModelsRepositories,MIRON-BehaviorRepository,MIRON-DataRepository,Groot,MOOD2Be,Total
Unique Views,4,8,3,5,1,0,0,21
Views Count,59,51,18,13,4,0,0,145
Unique Clones,1,0,5,1,1,0,0,8
Clones Count,1,0,5,1,1,0,0,8
45 changes: 45 additions & 0 deletions insights.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@

from github import Github
from datetime import datetime
import csv
import sys

repos = ['MIRON-Components', 'MIRON-Systems',
'DomainModelsRepositories', 'MIRON-BehaviorRepository',
'MIRON-DataRepository', 'Groot', 'MOOD2Be']

unique_view = ['Unique Views']
total_view = ['Views Count']
unique_clone = ['Unique Clones']
total_clone = ['Clones Count']

if __name__ == "__main__":
a = sys.argv[1]
b = sys.argv[2]
g = Github(a, b)
for org in g.get_user().get_orgs():
if org.name == 'MiRoN':
for r in repos:
repo = org.get_repo(r)
views = repo.get_views_traffic('week')
unique_view.append(views.get('uniques'))
total_view.append(views.get('count'))
clones = repo.get_clones_traffic('week')
unique_clone.append(clones.get('uniques'))
total_clone.append(clones.get('count'))

with open(datetime.today().strftime('%Y-%m-%d') + '.csv', mode='w') as file:
writer = csv.writer(file, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL)

writer.writerow([' '] + repos + ['Total'])

writer.writerow(unique_view + [sum(unique_view[1:])])
writer.writerow(total_view + [sum(total_view[1:])])
writer.writerow(unique_clone + [sum(unique_clone[1:])])
writer.writerow(total_clone + [sum(total_clone[1:])])

print(unique_view)
print(total_view)
print(unique_clone)
print(total_view)

0 comments on commit 0c37279

Please sign in to comment.