Compare commits

..

2 Commits

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" 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"]:
md += f"### 📂 Repository Breakdown\n\n" 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 = [] tab_rows = []
for repo in data["repos"]: for repo in data["repos"]:
tab_rows.append([ tab_rows.append([
repo["name"], repo["name"],
repo["language"], repo["language"],
format_bytes(repo["size"]), 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["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 += tabulate.tabulate(tab_rows, headers=tab_headers, tablefmt="pipe")
md += "\n\n" md += "\n\n"
@@ -125,6 +126,8 @@ def do_readme_build():
def debug_request(): def debug_request():
headers = {"Authorization": f"token {GITEA_TOKEN}"} headers = {"Authorization": f"token {GITEA_TOKEN}"}
version_info = do_request(f"{GITEA_URL}/api/v1/version", headers=headers) 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" version_string = version_info.get("version", "Unknown") if version_info else "Unknown"
if version_info: if version_info:
print(f"Gitea Version: {version_string}") print(f"Gitea Version: {version_string}")
@@ -153,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.