Refactor collect_gitea_data to include release count and update README generation logic

This commit is contained in:
2026-02-28 14:35:07 +00:00
parent 25fb1a3604
commit f89ed9bcda

View File

@@ -56,12 +56,11 @@ def collect_gitea_data():
"release_count": repo.get("release_count", 0), "release_count": repo.get("release_count", 0),
}) })
return { return {
"username": USERNAME, "username": USERNAME,
"version": version_string, "version": version_string,
"uptime": get_uptime(), "uptime": get_uptime(),
"repos": repos or [] "repos": repos or [],
} }
def do_readme_parse(): def do_readme_parse():
@@ -70,6 +69,7 @@ def do_readme_parse():
languages_used = set(repo["language"] for repo in data["repos"] if repo["language"] != "N/A") languages_used = set(repo["language"] for repo in data["repos"] if repo["language"] != "N/A")
username = data["username"].capitalize() if data["username"] else "Unknown User" username = data["username"].capitalize() if data["username"] else "Unknown User"
md = f"# {username}'s Developer Hub\n\n" md = f"# {username}'s Developer Hub\n\n"
md += f"## Welcome to {username}'s Gitea Developer Hub! This is a collection of repositories and projects that I have created and maintained on my Gitea instance. Here you can find various projects that I have worked on, ranging from personal projects to open-source contributions.\n\n" md += f"## Welcome to {username}'s Gitea Developer Hub! This is a collection of repositories and projects that I have created and maintained on my Gitea instance. Here you can find various projects that I have worked on, ranging from personal projects to open-source contributions.\n\n"
if data["repos"]: if data["repos"]:
@@ -156,5 +156,5 @@ def debug_request():
print("!"*30) print("!"*30)
if __name__ == "__main__": if __name__ == "__main__":
debug_request() # Uncomment this line to run the debug function and see the API responses and collected data #debug_request() # Uncomment this line to run the debug function and see the API responses and collected data
#do_readme_build() # This will build the README file using the collected data from the Gitea API and the template defined in the do_readme_parse function. do_readme_build() # This will build the README file using the collected data from the Gitea API and the template defined in the do_readme_parse function.