我想知道如何使用python检查公共git存储库是否更新(如果它们是新提交)。在这方面的帮助将不胜感激。
PyGitHub非常适合此操作,您可以这样做:
for repo in g.get_organization(ORGANIZATION).get_repos():
print(f"Processing {repo.full_name}...")
commit_activity = repo.get_stats_commit_activity()
# We have 52 weeks of commit history to total up
annual_commits = 0
for week in commit_activity:
annual_commits += week.total
print(f"Totalled {annual_commits} commits.")
https://pygithub.readthedocs.io/en/latest/github_objects/Repository.html github.Repository.Repository.get_stats_commit_activity