Skip to content

Commit fa839a3

Browse files
committed
added: methods get_contributors and get_issues
1 parent 7eddf51 commit fa839a3

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

GitHubRepoAPI.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,26 @@ def get_commits(self, repo: Repository) -> List[Commit]:
2525
except Exception as e:
2626
logging.error(f"Failed to get commits from GitHub for repo {repo.name}: {e}")
2727
return []
28+
29+
def get_contributors(self, repo: Repository) -> List[Contributor]:
30+
try:
31+
contributors = self.client.get_repo(repo.id).get_contributors()
32+
return [Contributor(c.login, c.email or "") for c in contributors]
33+
except Exception as e:
34+
logging.error(f"Failed to get contributors from GitHub for repo {repo.name}: {e}")
35+
return []
36+
37+
def get_issues(self, repo: Repository) -> List[Issue]:
38+
try:
39+
issues = self.client.get_repo(repo.id).get_issues(state='all')
40+
return [
41+
Issue(
42+
i.number,
43+
i.title,
44+
Contributor(i.user.login, i.user.email or ""),
45+
i.state
46+
) for i in issues
47+
]
48+
except Exception as e:
49+
logging.error(f"Failed to get issues from GitHub for repo {repo.name}: {e}")
50+
return []

0 commit comments

Comments
 (0)