2024-01-15 17:55:54 +00:00
|
|
|
import csv
|
|
|
|
import json
|
|
|
|
import os
|
|
|
|
from git import Repo
|
|
|
|
import shutil
|
|
|
|
|
|
|
|
key = os.environ.get('KKEXKEY')
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
wd = os.getcwd()
|
2024-02-23 16:25:13 +00:00
|
|
|
with open("kk_final_expanded_data_final.csv", "r") as file:
|
2024-01-15 17:55:54 +00:00
|
|
|
reader = csv.reader(file)
|
|
|
|
for i, line in enumerate(reader):
|
|
|
|
print("")
|
|
|
|
repo_name = line[5].strip().split("/")[-1]
|
|
|
|
print("on " + repo_name)
|
|
|
|
repo_url = str(line[5].strip())
|
2024-02-23 16:25:13 +00:00
|
|
|
temp_dir = "/data/users/mgaughan/kkex_readme_021824/tmp" + repo_name
|
2024-01-15 17:55:54 +00:00
|
|
|
try:
|
|
|
|
Repo.clone_from(repo_url, temp_dir)
|
|
|
|
except:
|
|
|
|
print("issue cloning")
|
|
|
|
continue
|
2024-02-23 16:25:13 +00:00
|
|
|
'''
|
2024-01-15 17:55:54 +00:00
|
|
|
if os.path.exists(temp_dir + "/.all-contributorsrc"):
|
|
|
|
shutil.copyfile(temp_dir + "/.all-contributorsrc", "/data/users/mgaughan/kkex_contrib_files_122023/contributing_lists/" + repo_name + "_contrib.json")
|
|
|
|
if os.path.exists(temp_dir + "/CONTRIBUTING.md"):
|
|
|
|
shutil.copyfile(temp_dir + "/CONTRIBUTING.md", "/data/users/mgaughan/kkex_contrib_files_122023/contribute_inst/" + repo_name + "_inst.md")
|
2024-02-23 16:25:13 +00:00
|
|
|
'''
|
|
|
|
#cannot run yet, with api chokepoint
|
|
|
|
if os.path.exists(temp_dir + "/README.md"):
|
|
|
|
shutil.copyfile(temp_dir + "/README.md", "/data/users/mgaughan/kkex_files_022124/readme/" + repo_name + "_readme.md")
|
|
|
|
if os.path.exists(temp_dir + "/GOVERNANCE.md"):
|
|
|
|
shutil.copyfile(temp_dir + "/GOVERNANCE.md", "/data/users/mgaughan/kkex_files_022124/governance/" + repo_name + "_readme.md")
|
2024-01-15 17:55:54 +00:00
|
|
|
shutil.rmtree(temp_dir, ignore_errors=True)
|
2024-02-23 16:25:13 +00:00
|
|
|
print('done')
|
|
|
|
|
|
|
|
|
2024-01-15 17:55:54 +00:00
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
main()
|