Enhance README generation by adding access links to repositories and improving release count display; update debug request functionality

This commit is contained in:
2026-02-28 14:11:13 +00:00
parent 78e52b9ec2
commit a620be202e

View File

@@ -74,16 +74,17 @@ def do_readme_parse():
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"]:
md += f"### 📂 Repository Breakdown\n\n"
tab_headers = ["Name", "Language", "Size", "Releases", "Private", "Archived"]
tab_headers = ["Name", "Language", "Size", "Releases", "Private", "Archived", "Access Link"]
tab_rows = []
for repo in data["repos"]:
tab_rows.append([
repo["name"],
repo["language"],
format_bytes(repo["size"]),
repo["release_count"],
repo["release_count"]if repo["release_count"] > 0 else "None",
"Yes" if repo["private"] else "No",
"Yes" if repo["archived"] else "No"
"Yes" if repo["archived"] else "No",
f"[View]({GITEA_URL}/{USERNAME}/{repo['name']})"
])
md += tabulate.tabulate(tab_rows, headers=tab_headers, tablefmt="pipe")
md += "\n\n"
@@ -125,6 +126,8 @@ def do_readme_build():
def debug_request():
headers = {"Authorization": f"token {GITEA_TOKEN}"}
version_info = do_request(f"{GITEA_URL}/api/v1/version", headers=headers)
users_heatmap = do_request(f"{GITEA_URL}/api/v1/users/{USERNAME}/heatmap", headers=headers)
print(f"User Heatmap: {users_heatmap}")
version_string = version_info.get("version", "Unknown") if version_info else "Unknown"
if version_info:
print(f"Gitea Version: {version_string}")
@@ -153,5 +156,5 @@ def debug_request():
print("!"*30)
if __name__ == "__main__":
#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.
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.