-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathmarkdown_writer.py
33 lines (31 loc) · 1.18 KB
/
markdown_writer.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
30
31
32
33
"""Write the results to a markdown file"""
def write_to_markdown(
users_count,
pull_count,
no_codeowners_count,
codeowners_count,
repo_and_users_to_remove,
repos_missing_codeowners,
):
"""Write the results to a markdown file"""
with open("report.md", "w", encoding="utf-8") as file:
file.write(
"# Cleanowners Report\n\n"
"## Overall Stats\n"
f"{users_count} Users to Remove\n"
f"{pull_count} Pull Requests created\n"
f"{no_codeowners_count} Repositories with no CODEOWNERS file\n"
f"{codeowners_count} Repositories with CODEOWNERS file\n"
)
if repo_and_users_to_remove:
file.write("## Repositories and Users to Remove\n")
for repo, users in repo_and_users_to_remove.items():
file.write(f"{repo}\n")
for user in users:
file.write(f"- {user}\n")
file.write("\n")
if repos_missing_codeowners:
file.write("## Repositories Missing CODEOWNERS\n")
for repo in repos_missing_codeowners:
file.write(f"- {repo}\n")
file.write("\n")