Skip to content

Commit

Permalink
update_readme.py
Browse files Browse the repository at this point in the history
  • Loading branch information
byt3n33dl3 authored Jul 18, 2024
1 parent 870dbc8 commit 11438e7
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .github/test/update_readme.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import json

with open('used_by_repos.json') as f:
data = json.load(f)

repos = data.get('items', [])

with open('readme.md', 'r') as f:
lines = f.readlines()

start_idx = next(i for i, line in enumerate(lines) if line.strip() == "## Used By") + 1
end_idx = next((i for i, line in enumerate(lines[start_idx:], start=start_idx) if line.startswith("##")), len(lines))

new_lines = lines[:start_idx] + [f"- [{repo['full_name']}]({repo['html_url']}): {repo.get('description', 'No description available')}\n" for repo in repos] + lines[end_idx:]

with open('readme.md', 'w') as f:
f.writelines(new_lines)

0 comments on commit 11438e7

Please sign in to comment.