-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlatest_commit_finder.py
More file actions
35 lines (23 loc) · 946 Bytes
/
Copy pathlatest_commit_finder.py
File metadata and controls
35 lines (23 loc) · 946 Bytes
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
from github import Github, GithubException
import pandas as pd
#Connecting to GitHub account using personal access key
token_file = open("github_access_token.txt")
ACCESS_TOKEN = token_file.readline()
token_file.close()
g = Github(ACCESS_TOKEN)
#Pulling "Repo Link" collumn from dataset
apps = pd.read_excel("dataset.xlsx")
repo_links = apps["Repo Link"]
#Main Program
output = open("last_commits.txt", 'w')
for repo_link in repo_links:
repo_id = repo_link.replace("https://github.com/", '')
try:
repo = g.get_repo(repo_id)
commits = repo.get_commits()
latest_commit = str(commits[0].commit.committer.date)
latest_commit_formatted = latest_commit.split(" ")[0]
output.write(latest_commit_formatted + '\n')
except GithubException:
output.write("Couldn't find repo, enter date manually\n")
output.close()