Add .gitignore file to exclude unnecessary files and directories; update Gitea badges workflow to use INSTANCE_URL; enhance badge awarding script with slug handling and update badges.json for user exclusions and tier formatting
This commit is contained in:
1 parent
3a5ec76030
commit
ec8522633b
4 files changed
+323
-23
No files matched your search
@@ -167,6 +167,12 @@ def resolve_email(email, email_map, users, cfg):
|
||||
|
||||
|
||||
# --------------------------------------------------------------------- badges
|
||||
def badge_slug(b):
|
||||
"""Gitea's /admin/users/{u}/badges returns the raw DB model (no json tags),
|
||||
so keys are "Slug"/"ID"/... — accept both spellings to be safe."""
|
||||
return b.get("slug") or b.get("Slug")
|
||||
|
||||
|
||||
def metric_values(stats, login):
|
||||
return {
|
||||
"max_stars": stats.max_stars.get(login, -1), # -1 => owns no repo
|
||||
@@ -254,7 +260,7 @@ def main():
|
||||
changes = 0
|
||||
for login in sorted(users):
|
||||
want = desired_badges(metric_values(stats, login), families, tier_mode)
|
||||
have = {b["slug"] for b in (api.get(f"/admin/users/{login}/badges") or [])}
|
||||
have = {badge_slug(b) for b in (api.get(f"/admin/users/{login}/badges") or [])} - {None}
|
||||
add = sorted(want - have)
|
||||
rm = sorted((have & managed) - want) if revoke else []
|
||||
if not add and not rm:
|
||||
|
||||
Reference in new issue
Block a user