Compare commits

...

192 Commits

Author SHA1 Message Date
Gitea Action
1a4b276aea Update profile stats 2026-03-22 07:00:56 +00:00
Gitea Action
e514b1dedb Update profile stats 2026-03-22 06:01:58 +00:00
Gitea Action
06b7cc1e26 Update profile stats 2026-03-22 05:02:24 +00:00
Gitea Action
84a5bae75d Update profile stats 2026-03-22 04:02:26 +00:00
Gitea Action
fd03e950b2 Update profile stats 2026-03-22 03:02:27 +00:00
Gitea Action
9b06b91230 Update profile stats 2026-03-22 02:18:26 +00:00
Gitea Action
8b37091e6f Update profile stats 2026-03-22 01:21:47 +00:00
Gitea Action
1936211bb7 Update profile stats 2026-03-14 19:08:33 +00:00
Gitea Action
f10dae243a Update profile stats 2026-03-08 18:06:27 +00:00
Gitea Action
81c899609a Update profile stats 2026-03-08 17:03:16 +00:00
Gitea Action
ab310968a6 Update profile stats 2026-03-08 16:01:51 +00:00
Gitea Action
f25c4c324f Update profile stats 2026-03-08 15:01:21 +00:00
Gitea Action
ef7ae3d289 Update profile stats 2026-03-08 14:02:18 +00:00
Gitea Action
4aba5079cf Update profile stats 2026-03-08 13:01:35 +00:00
Gitea Action
ee576c5594 Update profile stats 2026-03-08 12:01:23 +00:00
Gitea Action
9d25d90893 Update profile stats 2026-03-08 11:01:44 +00:00
Gitea Action
09ed909c1c Update profile stats 2026-03-08 10:01:53 +00:00
Gitea Action
0f299f7f71 Update profile stats 2026-03-08 09:01:45 +00:00
Gitea Action
fdf42fc68d Update profile stats 2026-03-08 08:01:33 +00:00
Gitea Action
b7b82a8736 Update profile stats 2026-03-08 07:01:44 +00:00
Gitea Action
cb5ae0ef3f Update profile stats 2026-03-08 06:01:56 +00:00
Gitea Action
4a3987e5d0 Update profile stats 2026-03-08 05:02:25 +00:00
Gitea Action
403ae7fcbc Update profile stats 2026-03-08 04:02:13 +00:00
Gitea Action
5284712005 Update profile stats 2026-03-08 03:02:30 +00:00
Gitea Action
f27f717249 Update profile stats 2026-03-08 02:02:54 +00:00
Gitea Action
cec0a6cb95 Update profile stats 2026-03-08 01:01:56 +00:00
Gitea Action
035b7e52ee Update profile stats 2026-03-08 00:02:05 +00:00
Gitea Action
6c790d78f2 Update profile stats 2026-03-07 23:02:23 +00:00
Gitea Action
331acf4d8f Update profile stats 2026-03-07 22:01:53 +00:00
Gitea Action
fa10e7fc52 Update profile stats 2026-03-07 21:01:53 +00:00
Gitea Action
3fb8a54fbb Update profile stats 2026-03-07 20:01:31 +00:00
Gitea Action
c4450d7990 Update profile stats 2026-03-07 19:01:17 +00:00
Gitea Action
0a1708c6f4 Update profile stats 2026-03-07 18:02:04 +00:00
Gitea Action
f0be06e303 Update profile stats 2026-03-07 17:00:56 +00:00
Gitea Action
b70c35475e Update profile stats 2026-03-07 15:04:33 +00:00
Gitea Action
e3afcc53c2 Update profile stats 2026-03-07 14:19:28 +00:00
d2b9e66c10 fix: 🐛 Added git pull functionality to workflow.
Added a git pull function to my workflow to allow repo synchronosity.
2026-03-07 14:17:47 +00:00
Gitea Action
e94a65726a Update profile stats 2026-03-05 18:23:08 +00:00
Gitea Action
1367b24436 Update profile stats 2026-03-05 17:09:34 +00:00
Gitea Action
af88cc4305 Update profile stats 2026-03-05 16:04:34 +00:00
Gitea Action
d829ecb79c Update profile stats 2026-03-05 15:01:01 +00:00
Gitea Action
9afdf504d6 Update profile stats 2026-03-05 14:01:06 +00:00
Gitea Action
b517797b10 Update profile stats 2026-03-05 13:55:56 +00:00
7f88e080cc feat: Added new organisation tracking and some basic badges.
Edited the repos table so it contains a badge displaying last commit time, and created a new table displaying current owned organisations.
2026-03-05 13:55:08 +00:00
Gitea Action
d681e06239 Update profile stats 2026-03-05 13:01:02 +00:00
Gitea Action
f26e3adc4c Update profile stats 2026-03-05 12:00:51 +00:00
Gitea Action
758879ba87 Update profile stats 2026-03-05 11:00:48 +00:00
Gitea Action
4a70d27f8b Update profile stats 2026-03-05 10:00:56 +00:00
Gitea Action
e8c3606295 Update profile stats 2026-03-05 09:00:43 +00:00
Gitea Action
3ac2246a7d Update profile stats 2026-03-05 08:00:45 +00:00
Gitea Action
100d4b6dd1 Update profile stats 2026-03-05 07:00:45 +00:00
Gitea Action
839984d5c8 Update profile stats 2026-03-05 06:01:21 +00:00
Gitea Action
34830c406f Update profile stats 2026-03-05 05:00:53 +00:00
Gitea Action
801b73ef29 Update profile stats 2026-03-05 04:00:53 +00:00
Gitea Action
8cca9bc1ae Update profile stats 2026-03-05 03:01:21 +00:00
Gitea Action
a5e30ba57c Update profile stats 2026-03-05 02:01:18 +00:00
Gitea Action
1f50a52519 Update profile stats 2026-03-05 01:00:50 +00:00
Gitea Action
f261436efe Update profile stats 2026-03-05 00:01:08 +00:00
Gitea Action
8f64fa003a Update profile stats 2026-03-04 23:01:01 +00:00
Gitea Action
3c10363e22 Update profile stats 2026-03-04 22:01:23 +00:00
Gitea Action
e463247b08 Update profile stats 2026-03-04 21:01:48 +00:00
Gitea Action
47a5d53408 Update profile stats 2026-03-04 20:01:42 +00:00
Gitea Action
6a5d1ea61b Update profile stats 2026-03-04 19:00:58 +00:00
Gitea Action
0a7f38c71f Update profile stats 2026-03-04 18:01:42 +00:00
Gitea Action
a963c17669 Update profile stats 2026-03-04 17:00:50 +00:00
Gitea Action
2fb69a4aec Update profile stats 2026-03-04 16:00:41 +00:00
Gitea Action
ffa5177cc5 Update profile stats 2026-03-04 15:01:13 +00:00
Gitea Action
8f8d187bde Update profile stats 2026-03-04 14:00:55 +00:00
Gitea Action
fa3c40e493 Update profile stats 2026-03-04 13:00:42 +00:00
Gitea Action
c35f8ddd8a Update profile stats 2026-03-04 12:00:52 +00:00
Gitea Action
c504943f84 Update profile stats 2026-03-04 11:01:50 +00:00
Gitea Action
a821dbfccf Update profile stats 2026-03-04 10:00:56 +00:00
Gitea Action
67480298f8 Update profile stats 2026-03-04 09:00:53 +00:00
Gitea Action
d71561563b Update profile stats 2026-03-04 08:00:45 +00:00
Gitea Action
c5d80fe762 Update profile stats 2026-03-04 07:00:55 +00:00
Gitea Action
c4b80f9c2b Update profile stats 2026-03-04 06:00:53 +00:00
Gitea Action
135c35c7b8 Update profile stats 2026-03-04 05:00:31 +00:00
Gitea Action
99f1f1fc37 Update profile stats 2026-03-04 04:00:49 +00:00
Gitea Action
68d9fe4e9a Update profile stats 2026-03-04 03:01:07 +00:00
Gitea Action
23217107ac Update profile stats 2026-03-04 02:01:11 +00:00
Gitea Action
9789defce1 Update profile stats 2026-03-04 01:00:49 +00:00
Gitea Action
fe3526ad09 Update profile stats 2026-03-04 00:01:07 +00:00
Gitea Action
c1d3bceb2a Update profile stats 2026-03-03 23:01:28 +00:00
Gitea Action
d485837b42 Update profile stats 2026-03-03 22:01:13 +00:00
Gitea Action
70359cba80 Update profile stats 2026-03-03 21:00:56 +00:00
Gitea Action
bcc08a5213 Update profile stats 2026-03-03 20:01:27 +00:00
Gitea Action
b0c69a129a Update profile stats 2026-03-03 19:01:18 +00:00
Gitea Action
0f3a03a88c Update profile stats 2026-03-03 18:01:56 +00:00
Gitea Action
f0627b3c0b Update profile stats 2026-03-03 16:02:23 +00:00
Gitea Action
12e42cbfe3 Update profile stats 2026-03-03 15:02:49 +00:00
Gitea Action
7ebb379b14 Update profile stats 2026-03-03 14:01:59 +00:00
Gitea Action
a01d72085e Update profile stats 2026-03-03 13:01:33 +00:00
Gitea Action
e246710c70 Update profile stats 2026-03-03 12:01:31 +00:00
Gitea Action
2b8184d926 Update profile stats 2026-03-03 11:01:17 +00:00
Gitea Action
fc48d86767 Update profile stats 2026-03-03 10:01:54 +00:00
Gitea Action
2b3f4548d8 Update profile stats 2026-03-03 09:01:28 +00:00
Gitea Action
4a3a37699d Update profile stats 2026-03-03 08:01:22 +00:00
Gitea Action
d45aa0e391 Update profile stats 2026-03-03 07:01:22 +00:00
Gitea Action
d23fdc3f17 Update profile stats 2026-03-03 06:01:52 +00:00
Gitea Action
09e949986a Update profile stats 2026-03-03 05:01:26 +00:00
Gitea Action
f9eab05189 Update profile stats 2026-03-03 04:01:39 +00:00
Gitea Action
171fb8de7c Update profile stats 2026-03-03 03:01:41 +00:00
Gitea Action
4e4c735876 Update profile stats 2026-03-03 02:02:32 +00:00
Gitea Action
c4d0199349 Update profile stats 2026-03-03 01:01:04 +00:00
Gitea Action
13561392ae Update profile stats 2026-03-03 00:01:22 +00:00
Gitea Action
fcbee2e07e Update profile stats 2026-03-02 23:03:46 +00:00
Gitea Action
258d4288d9 Update profile stats 2026-03-02 22:03:30 +00:00
Gitea Action
8992eb706d Update profile stats 2026-03-02 20:03:13 +00:00
Gitea Action
2fcd32ff41 Update profile stats 2026-03-02 19:01:31 +00:00
Gitea Action
fe3044ab1f Update profile stats 2026-03-02 18:03:30 +00:00
Gitea Action
6de4a8e899 Update profile stats 2026-03-02 17:02:11 +00:00
Gitea Action
b3f0f91f9e Update profile stats 2026-03-02 16:01:56 +00:00
Gitea Action
33ff18f3ce Update profile stats 2026-03-02 15:01:49 +00:00
Gitea Action
55dee7772c Update profile stats 2026-03-02 14:02:30 +00:00
Gitea Action
64367a916d Update profile stats 2026-03-02 13:01:31 +00:00
Gitea Action
e3db71cb05 Update profile stats 2026-03-02 12:01:30 +00:00
Gitea Action
62539824a3 Update profile stats 2026-03-02 11:01:13 +00:00
Gitea Action
823aa6c319 Update profile stats 2026-03-02 10:01:25 +00:00
Gitea Action
d10103e1ce Update profile stats 2026-03-02 09:01:08 +00:00
Gitea Action
0dc439e5d4 Update profile stats 2026-03-02 08:01:15 +00:00
Gitea Action
c7d4a9c96f Update profile stats 2026-03-02 07:01:08 +00:00
Gitea Action
37926d5c2f Update profile stats 2026-03-02 06:01:27 +00:00
Gitea Action
2c90c19c83 Update profile stats 2026-03-02 05:01:22 +00:00
Gitea Action
6bab05409a Update profile stats 2026-03-02 04:01:33 +00:00
Gitea Action
889695a592 Update profile stats 2026-03-02 03:01:39 +00:00
Gitea Action
52af2611cc Update profile stats 2026-03-02 02:01:29 +00:00
Gitea Action
01d3f7da4f Update profile stats 2026-03-02 01:01:27 +00:00
Gitea Action
aba04dc511 Update profile stats 2026-03-02 00:02:10 +00:00
Gitea Action
b22da4d8cc Update profile stats 2026-03-01 23:01:47 +00:00
Gitea Action
44d0e08996 Update profile stats 2026-03-01 22:01:57 +00:00
Gitea Action
6899f3ccb9 Update profile stats 2026-03-01 21:01:51 +00:00
Gitea Action
e57c72f385 Update profile stats 2026-03-01 19:04:43 +00:00
Gitea Action
949ae2effb Update profile stats 2026-03-01 18:04:03 +00:00
Gitea Action
29d46969de Update profile stats 2026-03-01 17:02:10 +00:00
Gitea Action
8713d0a303 Update profile stats 2026-03-01 16:01:56 +00:00
Gitea Action
f340adff05 Update profile stats 2026-03-01 15:02:19 +00:00
Gitea Action
315b48683f Update profile stats 2026-03-01 14:01:56 +00:00
Gitea Action
49548b5192 Update profile stats 2026-03-01 13:01:26 +00:00
Gitea Action
b26b6c9fc7 Update profile stats 2026-03-01 12:01:32 +00:00
Gitea Action
7686aa430c Update profile stats 2026-03-01 11:01:48 +00:00
Gitea Action
08a7cd86b4 Update profile stats 2026-03-01 10:02:29 +00:00
Gitea Action
0200997f00 Update profile stats 2026-03-01 09:01:44 +00:00
Gitea Action
d77fc6476d Update profile stats 2026-03-01 08:01:33 +00:00
Gitea Action
96c1cb5cf1 Update profile stats 2026-03-01 07:01:21 +00:00
Gitea Action
aed0193c04 Update profile stats 2026-03-01 06:01:38 +00:00
Gitea Action
8f9d1dea3f Update profile stats 2026-03-01 05:01:22 +00:00
Gitea Action
a50b46b47e Update profile stats 2026-03-01 04:01:49 +00:00
Gitea Action
73417aa86a Update profile stats 2026-03-01 03:02:38 +00:00
Gitea Action
d2a50dd914 Update profile stats 2026-03-01 02:01:49 +00:00
Gitea Action
8a58ec3d7d Update profile stats 2026-03-01 01:01:50 +00:00
Gitea Action
96210f0c41 Update profile stats 2026-03-01 00:02:44 +00:00
Gitea Action
3f015ba8c6 Update profile stats 2026-02-28 23:02:13 +00:00
Gitea Action
d34043d332 Update profile stats 2026-02-28 22:01:54 +00:00
Gitea Action
7064ce5329 Update profile stats 2026-02-28 21:01:40 +00:00
Gitea Action
54a871bde6 Update profile stats 2026-02-28 20:01:58 +00:00
Gitea Action
8af023068a Update profile stats 2026-02-28 19:01:21 +00:00
Gitea Action
67d4776efc Update profile stats 2026-02-28 18:01:47 +00:00
Gitea Action
4037d8040b Update profile stats 2026-02-28 17:01:05 +00:00
Gitea Action
b9f16b611d Update profile stats 2026-02-28 16:01:07 +00:00
Gitea Action
bf92f5e477 Update profile stats 2026-02-28 15:00:59 +00:00
Gitea Action
f74521533a Update profile stats 2026-02-28 14:35:47 +00:00
f89ed9bcda Refactor collect_gitea_data to include release count and update README generation logic 2026-02-28 14:35:07 +00:00
25fb1a3604 Merge branch 'main' of https://gitea.nathan-falvey.synology.me/nathan/.profile 2026-02-28 14:11:16 +00:00
a620be202e Enhance README generation by adding access links to repositories and improving release count display; update debug request functionality 2026-02-28 14:11:13 +00:00
Gitea Action
8b22a7d9f1 Update profile stats 2026-02-28 14:01:07 +00:00
Gitea Action
b8e068f87b Update profile stats 2026-02-28 13:54:47 +00:00
78e52b9ec2 Merge branch 'main' of https://gitea.nathan-falvey.synology.me/nathan/.profile 2026-02-28 13:54:08 +00:00
ccb6d15776 Add tabulate dependency and enhance README generation with repository release count 2026-02-28 13:54:07 +00:00
Gitea Action
60d8ac5200 Update profile stats 2026-02-28 13:49:05 +00:00
b653cfd8cb Merge branch 'main' of https://gitea.nathan-falvey.synology.me/nathan/.profile 2026-02-28 13:48:28 +00:00
1c68c76437 Enhance README generation with improved user display and stats summary; format languages used section 2026-02-28 13:48:27 +00:00
Gitea Action
55f09261a8 Update profile stats 2026-02-28 13:44:16 +00:00
9ef07b5069 Implement Gitea data collection and README generation; enhance debug_request output 2026-02-28 13:43:17 +00:00
4f58ddfc98 Add uptime retrieval and format_bytes function; enhance debug_request output 2026-02-28 13:16:56 +00:00
a408e9990c Enhance debug_request function to include additional repository details and add placeholder for README build logic 2026-02-28 13:14:03 +00:00
9871f2d47f Add user repository count output in debug_request function 2026-02-28 13:07:15 +00:00
ba8a4fbd0e Use pprint for better formatting of user repositories output in debug_request function 2026-02-28 13:05:31 +00:00
7ff549e9de Refactor debug_request function in update_profile.py to improve version information retrieval and enhance output clarity 2026-02-28 13:04:07 +00:00
2f4bddb11f Refactor debug_request function in update_profile.py to utilize do_request for improved error handling and code clarity
All checks were successful
Update Profile Stats / build (push) Successful in 48s
2026-02-27 23:36:14 +00:00
60ce2c5795 Fix GITEA_URL in update_profile.py by removing username from the URL 2026-02-27 23:26:24 +00:00
4774c885eb Update GITEA_URL and USERNAME in update_profile.py for correct configuration 2026-02-27 23:24:34 +00:00
7ac733521d Add --break-system-packages option to pip install command in update.yaml 2026-02-27 23:22:38 +00:00
68021a1534 Add requirements.txt for dependency management and update installation command in workflow 2026-02-27 23:21:13 +00:00
f890d48ffc Refactor update_profile.py to simplify Gitea data fetching and enhance debugging capabilities 2026-02-27 23:16:50 +00:00
9c3804b126 Add debug prints to fetch_gitea_data for feed structure and filtering verification 2026-02-27 23:13:51 +00:00
6cd314ded2 Add traceback logging for error handling in README rebuild 2026-02-27 23:11:07 +00:00
b7f60d75e7 Update GITEA_TOKEN environment variable to PROFILE_UPDATER_GITEA_TOKEN 2026-02-27 23:04:19 +00:00
504067d96d Merge branch 'main' of https://gitea.nathan-falvey.synology.me/nathan/.profile
All checks were successful
Update Profile Stats / build (push) Successful in 50s
2026-02-27 22:55:23 +00:00
3a64110e49 Refactor update_profile.py to enhance Gitea data fetching and README generation 2026-02-27 22:55:15 +00:00
a573d156aa Update README.md 2026-02-27 22:45:11 +00:00
a45383d5e4 Merge branch 'main' of https://gitea.nathan-falvey.synology.me/nathan/.profile 2026-02-27 22:44:20 +00:00
58180ff463 Fix case sensitivity in README file references for consistency 2026-02-27 22:44:19 +00:00
5 changed files with 220 additions and 1061 deletions

View File

@@ -12,7 +12,7 @@ jobs:
uses: actions/checkout@v4
- name: Install Requirements
run: pip3 install requests --break-system-packages
run: pip3 install -r requirements.txt --break-system-packages
- name: Run Update Script
env:
@@ -23,5 +23,6 @@ jobs:
run: |
git config --local user.email "action@gitea.com"
git config --local user.name "Gitea Action"
git add README.MD
git pull
git add README.md
git diff --quiet && git diff --staged --quiet || (git commit -m "Update profile stats" && git push)

1035
README.MD

File diff suppressed because it is too large Load Diff

28
README.md Normal file
View File

@@ -0,0 +1,28 @@
# Nathan's Developer Hub
## Welcome to Nathan'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.
### 📂 Repository Breakdown
| Name | Language | Size | Releases | Private | Archived | Access Link | Last Commit |
|:--------------------------------|:-----------|:---------|:-----------|:----------|:-----------|:---------------------------------------------------------------------------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| .profile | Python | 268.00 B | None | No | No | [View](https://gitea.nathan-falvey.synology.me/nathan/.profile) | ![Gitea Last Commit](https://img.shields.io/gitea/last-commit/nathan/.profile?gitea_url=https%3A%2F%2Fgitea.nathan-falvey.synology.me&style=flat-square) |
| custom-portainer-configurations | N/A | 55.00 B | None | No | No | [View](https://gitea.nathan-falvey.synology.me/nathan/custom-portainer-configurations) | ![Gitea Last Commit](https://img.shields.io/gitea/last-commit/nathan/custom-portainer-configurations?gitea_url=https%3A%2F%2Fgitea.nathan-falvey.synology.me&style=flat-square) |
## 📊 Stats Summary
**Total Repositories:** 2
**Total Storage Used:** 323.00 B
### **Languages Used:**
```
- **Python**
```
### System Information
**Gitea Version:** 1.25.5
**System Uptime:** 1:07:36

2
requirements.txt Normal file
View File

@@ -0,0 +1,2 @@
requests
tabulate

View File

@@ -1,34 +1,197 @@
import datetime
import os
import re
import requests
import traceback
import pprint
import datetime
import tabulate
def generate_stats():
now = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
return f"✅ My Gitea instance is alive and well!\n🕒 Last update: {now}."
# --- Configuration ---
GITEA_URL = "https://gitea.nathan-falvey.synology.me"
USERNAME = "nathan"
GITEA_TOKEN = os.getenv("GITEA_TOKEN")
def main():
readme_path = "README.MD"
def do_request(url, headers=None):
try:
response = requests.get(url, headers=headers)
response.raise_for_status() # Will raise an HTTPError for bad responses
return response.json()
except requests.exceptions.RequestException as e:
print(f"Request failed: {e}")
return None
if not os.path.exists(readme_path):
print(f"{readme_path} not found!")
return
def format_bytes(size_bytes):
"""Converts bytes to a human-readable string."""
if size_bytes == 0: return "0 B"
for unit in ['B', 'KB', 'MB', 'GB', 'TB']:
if size_bytes < 1024.0:
return f"{size_bytes:.2f} {unit}"
size_bytes /= 1024.0
return f"{size_bytes:.2f} PB"
with open(readme_path, "r", encoding="utf-8") as f:
content = f.read()
def get_uptime():
"""Reads Linux system uptime."""
try:
with open("/proc/uptime", "r") as f:
seconds = float(f.readline().split()[0])
return str(datetime.timedelta(seconds=int(seconds)))
except: return "Running in Container"
# Generate new dynamic content
stats_content = generate_stats()
# a function to collect all the necessary data from the Gitea API, this will be used to gather all the information needed to build the README file. This function will make multiple API calls to gather different pieces of information and then return it in a structured format that can be easily used to build the README file.
def collect_gitea_data():
headers = {"Authorization": f"token {GITEA_TOKEN}"}
version_info = do_request(f"{GITEA_URL}/api/v1/version", headers=headers)
version_string = version_info.get("version", "Unknown") if version_info else "Unknown"
repos_info = do_request(f"{GITEA_URL}/api/v1/users/{USERNAME}/repos?type=owner", headers=headers)
organisations_info = do_request(f"{GITEA_URL}/api/v1/users/{USERNAME}/orgs", headers=headers)
repos = []
if repos_info is not None:
for repo in repos_info:
if repo.get("has_code", False):
repos.append({
"name": repo.get("name", "N/A"),
"id": repo.get("id", "N/A"),
"private": repo.get("private", False),
"archived": repo.get("archived", False),
"language": repo.get("language", "N/A"),
"size": repo.get("size", 0),
"release_count": repo.get("release_count", 0),
})
# Replace content between the markers
pattern = r".*?"
replacement = f"\n{stats_content}\n"
new_content = re.sub(pattern, replacement, content, flags=re.DOTALL)
organisations = []
if organisations_info is not None:
for org in organisations_info:
organisations.append({
"name": org.get("name", "N/A"),
"id": org.get("id", "N/A"),
"private": org.get("private", False),
"description": org.get("description", "N/A"),
"full_name": org.get("full_name", "N/A"),
})
# 4. Save the file back to disk
with open(readme_path, "w", encoding="utf-8") as f:
f.write(new_content)
return {
"username": USERNAME,
"version": version_string,
"uptime": get_uptime(),
"repos": repos or [],
"organisations": organisations or [],
}
print("README.md updated locally.")
def do_readme_parse():
data = collect_gitea_data() # does all the API calls and collects the data into a structured format, collected once to avoid multiple API calls during the README build process, this data will be used to populate the README template with the relevant information about the Gitea instance and the user's repositories.
storage_used = sum(repo["size"] for repo in data["repos"])
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"
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"
if data["repos"]:
md += f"### 📂 Repository Breakdown\n\n"
tab_headers = ["Name", "Language", "Size", "Releases", "Private", "Archived", "Access Link", "Last Commit"]
tab_rows = []
for repo in data["repos"]:
tab_rows.append([
repo["name"],
repo["language"] if len(repo["language"]) > 1 else "N/A",
format_bytes(repo["size"]),
repo["release_count"]if repo["release_count"] > 0 else "None",
"Yes" if repo["private"] else "No",
"Yes" if repo["archived"] else "No",
f"[View]({GITEA_URL}/{USERNAME}/{repo['name']})",
f"![Gitea Last Commit](https://img.shields.io/gitea/last-commit/{USERNAME}/{repo['name']}?gitea_url=https%3A%2F%2Fgitea.nathan-falvey.synology.me&style=flat-square)"
])
md += tabulate.tabulate(tab_rows, headers=tab_headers, tablefmt="pipe")
md += "\n\n"
md += "## 📊 Stats Summary\n"
md += f"\n**Total Repositories:** {len(data['repos'])}\n\n"
md += f"**Total Storage Used:** {format_bytes(storage_used)}\n\n"
if languages_used:
md += f"### **Languages Used:**\n\n"
md += "```\n"
for lang in languages_used:
if len(lang) > 1: # Filter out empty or invalid language entries
md += f"- **{lang}**\n"
md += "```"
md += "\n"
if data["organisations"]:
md += f"### 🏢 Owned Organisation Breakdown\n\n"
tab_headers = ["Name", "Description", "Private", "Access Link"]
tab_rows = []
for org in data["organisations"]:
tab_rows.append([
org["name"],
org["description"] if len(org["description"]) > 1 else "N/A",
"Yes" if org["private"] else "No",
f"[View]({GITEA_URL}/{org['name']})"
])
md += tabulate.tabulate(tab_rows, headers=tab_headers, tablefmt="pipe")
md += "\n\n"
md += "\n"
md += "### System Information\n\n"
md += f"**Gitea Version:** {data['version']}\n\n"
md += f"**System Uptime:** {data['uptime']}\n\n"
return md
def do_readme_build():
try:
markdown = do_readme_parse().strip()
current_contents = open("README.md", "r", encoding="utf-8").read() if os.path.exists("README.md") else ""
if markdown == current_contents.strip():
print("README.md is already up to date. No changes made.")
return
with open("README.md", "w", encoding="utf-8") as f:
f.write(markdown)
print("README.md rebuilt successfully.")
except Exception as e:
print(f"Error: {e}")
pass # Placeholder for the actual README build logic
# a simple function to test the API connection and print some debug information, this will be used for debugging purposes to ensure that the API connection is working correctly and to see what data is being returned from the API calls.
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}")
print(f"System Uptime: {get_uptime()}")
try:
print(do_request(f"{GITEA_URL}/api/v1/version", headers=headers))
pprint.pprint(do_request(f"{GITEA_URL}/api/v1/user/repos?type=owner", headers=headers))
repos = do_request(f"{GITEA_URL}/api/v1/users/{USERNAME}/repos?type=owner", headers=headers)
if repos is not None:
print(f"Number of repos for user '{USERNAME}': {len(repos)}")
for repo in repos:
print(f"Repo Name: {repo.get('name', 'N/A')}, Repo ID: {repo.get('id', 'N/A')}")
if repo.get("has_code", False):
print(f"Repo '{repo.get('name', 'N/A')}' has code.")
print(f"Repo '{repo.get('name', 'N/A')}' is private: {repo.get('private', 'N/A')}")
print(f"Repo '{repo.get('name', 'N/A')}' is archived: {repo.get('archived', 'N/A')}")
print(f"Repo '{repo.get('name', 'N/A')}' has language: {repo.get('language', 'N/A')}")
print(f"Repo '{repo.get('name', 'N/A')}' has size: {repo.get('size', 'N/A')}")
except Exception:
print("\n" + "!"*30)
print("STACK TRACE (Line Numbers):")
traceback.print_exc()
print("!"*30)
if __name__ == "__main__":
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.