def main(): parser = argparse.ArgumentParser( description='moves the specified list of projects under a project list' ) parser.add_argument('-l', '--list-name', dest='list_name', required=True) parser.add_argument('-i', '--infile', dest='in_file', required=True, type=argparse.FileType('r')) args = parser.parse_args() site = LGTMSite.create_from_file() project_list_id = site.get_or_create_project_list(args.list_name) ids = [] for line in args.in_file: line_clean: str = line.strip() gh_project_path = line_clean.lstrip('https://github.com/') the_id = LGTMSite.retrieve_project_id(gh_project_path) if the_id is not None: print('Loaded: %s' % gh_project_path) ids.append(str(the_id)) site.load_into_project_list(project_list_id, ids)
def main(): parser = argparse.ArgumentParser( description= 'follow repositories from a list of newline delimited repositories') parser.add_argument('-i', '--infile', dest='in_file', required=True, type=argparse.FileType('r')) args = parser.parse_args() site = LGTMSite.create_from_file() for line in args.in_file: line_clean = line.strip() print('Following: %s' % line_clean) site.follow_repository(line_clean)
def find_and_save_projects_to_lgtm(language: str, search_term: str): github = utils.github_api.create() site = LGTMSite.create_from_file() for date_range in utils.github_dates.generate_dates(): repos = github.search_repositories( query=f'language:{language} created:{date_range} {search_term}') for repo in repos: # Github has rate limiting in place hence why we add a sleep here. More info can be found here: # https://docs.github.com/rest/overview/resources-in-the-rest-api#rate-limiting time.sleep(1) if repo.archived or repo.fork: continue save_project_to_lgtm(site, repo.full_name)
def main(): parser = argparse.ArgumentParser( description='display the build status of the specified repositories') parser.add_argument('-i', '--infile', dest='in_file', required=True, type=argparse.FileType('r')) args = parser.parse_args() unloaded_count = 0 total_count = 0 for line in args.in_file: line_clean: str = line.strip() total_count += 1 gh_project_path = line_clean.lstrip('https://github.com/') print('Checking status for %s' % gh_project_path) result = LGTMSite.retrieve_project(gh_project_path) print(result) if 'code' in result: unloaded_count += 1 print('%d/%d projects loaded' % (total_count - unloaded_count, total_count))
project_list_to_repo = { 'jOOq-Users': [ 'self-xdsd/self-storage', 'folio-org/mod-source-record-storage', 'ICIJ/datashare', 'hartwigmedical/hmftools', 'openforis/collect', 'jklingsporn/vertx-jooq', 'trib3/leakycauldron', 'ZupIT/charlescd', 'waikato-datamining/adams-applications' ] } # Flip the list gh_org_to_project_list_name: Dict[str, str] = {} for list_name in project_list_name_to_gh_org: for gh_org in project_list_name_to_gh_org[list_name]: gh_org_to_project_list_name[gh_org] = list_name site = LGTMSite.create_from_file() org_to_projects = LGTMDataFilters.org_to_ids(site.get_my_projects()) for org in org_to_projects: if org not in gh_org_to_project_list_name: print('Skipping %s as org location not specified' % org) continue project_list_name = gh_org_to_project_list_name[org] project_list_id = site.get_or_create_project_list(project_list_name) for project in org_to_projects[org]: if project.is_protoproject: print( 'Unable to add project to project list since it is a protoproject. %s' % project) continue site.load_into_project_list(project_list_id, [project.key]) site.unfollow_repository(project)