Last active
March 11, 2020 13:54
-
-
Save topless/3520c3c2e1ae3a0560d4321c7c5960ce to your computer and use it in GitHub Desktop.
invenio released versions sanity check
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Iterate through all invenio repositoried and find which ones changes since | |
# the since_date. Also find out which repositories have their last commits | |
# which are not releases | |
# NOTE: pip install PyGithub | |
import os | |
import json | |
from datetime import datetime | |
from github import Github | |
g = Github(os.environ["GITHUB_TOKEN"]) | |
since_date = datetime(2019, 11, 10) | |
# Repositories which have a commit since the since_date param | |
dirty_repos = [] | |
# Repositories whose last commit is not a release | |
not_released = [] | |
# This is a list of not used repositories (i.e. archived) which cause problems | |
skip_repositories = ['coordination'] | |
def run(): | |
repos = g.get_organization("inveniosoftware").get_repos() | |
print("{:<42} {}".format("Repository", "Last Commit")) | |
for repo in repos: | |
if repo.raw_data['name'] in skip_repositories: | |
continue | |
commits = repo.get_commits(since=since_date) or [] | |
if commits and commits.totalCount > 0: | |
dirty_repos.append(repo.name) | |
last_msg = commits[0].raw_data['commit']['message'].replace('\n', ' ') | |
print("{:<42} {}".format(repo.name, last_msg)) | |
if not last_msg.lower().startswith('release'): | |
not_released.append(repo.name) | |
with open('not_released.json', 'w') as f: | |
json.dump(not_released, f) | |
if __name__ == '__main__': | |
try: | |
run() | |
except Exception as e: | |
print(e) | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment