-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathreadme-generator.py
29 lines (21 loc) · 1.03 KB
/
readme-generator.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import json
json_file = open("repositories.json", "r")
repo_json = json.load(json_file)
json_file.close()
# Create a readme file
template_file = open("template.md", "r")
readme_file = open("README.md", "w")
readme_output = template_file.read()
readme_output += '\n'
repos = repo_json['repositories']
# Sort repos
repos = sorted(repos, key=lambda repo: repo['name'].lower())
for repo in repos:
readme_output += f"- [**{repo['name']}**]({repo['link']}) \n > {repo['description']} \n \
[]({repo['link']}/issues) ".replace(' ', '')
for label in repo['labels']:
shields_label = label.replace(' ', '%20')
url_label = label.replace(' ', '+')
readme_output += f"[]({repo['link']}/issues?q=is%3Aissue+is%3Aopen+label%3A%22{url_label}%22) "
readme_output += '\n\n'
readme_file.write(readme_output)