Refresh clone metrics and harden traffic fetch fallback

This commit is contained in:
h3p 2026-03-08 20:57:05 +01:00
parent ad8577a731
commit 272fc9bb22
5 changed files with 23 additions and 7 deletions

View file

@ -4,7 +4,9 @@ on:
release:
types: [published]
schedule:
- cron: "17 6 * * *"
- cron: "17 5 * * *"
- cron: "17 11 * * *"
- cron: "17 17 * * *"
workflow_dispatch:
permissions:

View file

@ -361,7 +361,7 @@
CODE_SIGNING_ALLOWED = YES;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 443;
CURRENT_PROJECT_VERSION = 444;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = CS727NF72U;
ENABLE_APP_SANDBOX = YES;
@ -444,7 +444,7 @@
CODE_SIGNING_ALLOWED = YES;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 443;
CURRENT_PROJECT_VERSION = 444;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = CS727NF72U;
ENABLE_APP_SANDBOX = YES;

View file

@ -86,7 +86,7 @@
</p>
<p align="center"><em>Styled line chart shows per-release totals plus a scaled 14-day git clone volume bar.</em></p>
<p align="center">Git clones (last 14 days): <strong>1629</strong>.</p>
<p align="center">Git clones (last 14 days): <strong>1965</strong>.</p>
<p align="center">Snapshot total downloads: <strong>571</strong> across releases.</p>
## Project Docs

View file

@ -78,12 +78,12 @@
<text x="776" y="56" fill="#D7F7FF" font-size="15" font-family="SF Pro Text, -apple-system, BlinkMacSystemFont, Segoe UI, sans-serif">Release trend line with highlighted points</text>
<rect x="58" y="390" width="1084" height="132" rx="12" fill="#0A1A2B" stroke="#2A4762" stroke-width="1"/>
<text x="84" y="420" fill="#E6F3FF" font-size="18" font-family="SF Pro Text, -apple-system, BlinkMacSystemFont, Segoe UI, sans-serif" font-weight="600">Git Clones (last 14 days): 1629</text>
<text x="84" y="420" fill="#E6F3FF" font-size="18" font-family="SF Pro Text, -apple-system, BlinkMacSystemFont, Segoe UI, sans-serif" font-weight="600">Git Clones (last 14 days): 1965</text>
<rect x="86" y="450" width="1024" height="36" rx="10" fill="#15263A" stroke="#2B4255" stroke-width="1"/>
<line x1="86" y1="442" x2="86" y2="494" stroke="#436280" stroke-width="1"/>
<line x1="598.0" y1="442" x2="598.0" y2="494" stroke="#436280" stroke-width="1"/>
<line x1="1110" y1="442" x2="1110" y2="494" stroke="#436280" stroke-width="1"/>
<rect x="86" y="450" width="834.0" height="36" rx="10" fill="url(#cloneFill)"/>
<rect x="86" y="450" width="1006.1" height="36" rx="10" fill="url(#cloneFill)"/>
<text x="82" y="438" text-anchor="start" fill="#9CC3E6" font-size="12" font-family="SF Pro Text, -apple-system, BlinkMacSystemFont, Segoe UI, sans-serif">0</text>
<text x="598.0" y="438" text-anchor="middle" fill="#9CC3E6" font-size="12" font-family="SF Pro Text, -apple-system, BlinkMacSystemFont, Segoe UI, sans-serif">1000</text>
<text x="1114" y="438" text-anchor="end" fill="#9CC3E6" font-size="12" font-family="SF Pro Text, -apple-system, BlinkMacSystemFont, Segoe UI, sans-serif">2000</text>

Before

Width:  |  Height:  |  Size: 7.9 KiB

After

Width:  |  Height:  |  Size: 7.9 KiB

View file

@ -15,6 +15,7 @@ import math
import os
import pathlib
import re
import subprocess
import sys
import urllib.request
from dataclasses import dataclass
@ -90,7 +91,20 @@ def fetch_clone_traffic() -> tuple[list[ClonePoint], int | None]:
try:
payload = github_api_get(CLONES_API_URL)
except Exception:
return [], None
payload = None
if payload is None:
# Local fallback: reuse authenticated gh CLI when direct API auth is unavailable.
try:
out = subprocess.run(
["gh", "api", f"repos/{OWNER}/{REPO}/traffic/clones"],
check=True,
capture_output=True,
text=True,
timeout=20,
)
payload = json.loads(out.stdout)
except Exception:
return [], None
if not isinstance(payload, dict):
return [], None