This commit is contained in:
1 parent
aec451d103
commit
0bd015c9a8
4 files changed
+89
-40
No files matched your search
+19
-11
@@ -23,10 +23,15 @@ Usage:
|
||||
gen_readme.py --check-links exit 1 if any link is not publicly reachable
|
||||
|
||||
Environment:
|
||||
GITEA_TOKEN required in Actions (provided per job); locally it
|
||||
falls back to ~/.config/gitea/qbit-maid-push.token
|
||||
GITEA_TOKEN optional. Set (even empty) wins; unset falls back to
|
||||
~/.config/gitea/qbit-maid-push.token. Empty means
|
||||
anonymous, which is enough for the public repos.
|
||||
KOMODO_API_KEY/SECRET optional; without them the stack/host counts are kept
|
||||
VIKUNJA_TOKEN optional; without it the completed block is kept
|
||||
|
||||
Every data source is reached over its public FQDN (git.jonb.io, k.jonb.io,
|
||||
todo.jonb.io, up.jonb.io), so the same script runs on the Gitea runner and on
|
||||
GitHub Actions.
|
||||
"""
|
||||
|
||||
import argparse
|
||||
@@ -64,19 +69,19 @@ def http_json(url, headers=None, data=None, timeout=25):
|
||||
|
||||
|
||||
def gitea_token():
|
||||
tok = os.environ.get("GITEA_TOKEN", "").strip()
|
||||
if tok:
|
||||
return tok
|
||||
"""Explicit GITEA_TOKEN wins (empty = anonymous); unset falls back to the
|
||||
local token file, then to anonymous."""
|
||||
tok = os.environ.get("GITEA_TOKEN")
|
||||
if tok is not None:
|
||||
return tok.strip()
|
||||
if LOCAL_TOKEN.exists():
|
||||
return LOCAL_TOKEN.read_text().strip()
|
||||
raise SystemExit("no GITEA_TOKEN and no local token file")
|
||||
return ""
|
||||
|
||||
|
||||
def gitea(path, tok):
|
||||
return http_json(
|
||||
"https://git.jonb.io/api/v1" + path,
|
||||
headers={"Authorization": "token " + tok},
|
||||
)
|
||||
headers = {"Authorization": "token " + tok} if tok else {}
|
||||
return http_json("https://git.jonb.io/api/v1" + path, headers=headers)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------- helpers
|
||||
@@ -115,7 +120,10 @@ def replace_block(text, name, body):
|
||||
|
||||
|
||||
def previous_int(text, pattern, default=0):
|
||||
m = re.search(pattern, text)
|
||||
# the rendered blocks wrap numbers in <span style="color:...">, so match
|
||||
# against the tag-stripped text or the fallback silently yields 0
|
||||
plain = re.sub(r"<[^>]+>", "", text)
|
||||
m = re.search(pattern, plain)
|
||||
return int(m.group(1)) if m else default
|
||||
|
||||
|
||||
|
||||
+2
-2
@@ -121,11 +121,11 @@
|
||||
"page": "homelab"
|
||||
},
|
||||
"komodo": {
|
||||
"base": "http://10.5.0.3:9120",
|
||||
"base": "https://k.jonb.io",
|
||||
"extra_hosts": 1
|
||||
},
|
||||
"vikunja": {
|
||||
"base": "http://10.5.0.3:3456",
|
||||
"base": "https://todo.jonb.io",
|
||||
"project": 2
|
||||
},
|
||||
"role": "technical account manager",
|
||||
|
||||
Reference in new issue
Block a user