forked from kongr45gpen/objective-commit-parser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgithub_commits.py
45 lines (33 loc) · 1.21 KB
/
github_commits.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
from github import Github
import json # not used, but adds COCOCO
from types import SimpleNamespace
import pickle
import yaml
MAXIMUM_COMMIT_LIMIT_PER_REPOSITORY = 100
github_token = "???"
print(github_token)
g = Github(github_token)
# a_yaml_file = open("python_repositories.yml")
# repositories = yaml.load(a_yaml_file, Loader=yaml. FullLoader)
file = open("html_commits.yml", "a")
repositories = pickle.load( open( "html_repositories.p", "rb" ) )
print("You have {} repositories".format(len(repositories)))
r = 0
for repo in repositories:
print("!!!!!!!!!!!!!!!!!!!!!!!!")
print("!!!!!")
print("{} OUT OF {} REPOSITORIES SCANNED".format(r, len(repositories)))
print("!!!!!!!!!!")
print(">>>>>>>>>{}/{}<<<<<<<<<<".format(repo.owner.login, repo.name))
print(" ")
r += 1
i = 0
for commit in repo.get_commits():
stats = commit.stats
print("[{}/{}]".format(i, MAXIMUM_COMMIT_LIMIT_PER_REPOSITORY), commit.commit.message, ": ", "Additions: ", stats.additions, "Deletions: ", stats.deletions)
the_pickle = yaml.dump(commit)
file.write(the_pickle)
file.write("\n")
i += 1
if i >= MAXIMUM_COMMIT_LIMIT_PER_REPOSITORY:
break