Skip to content

AirLLM 2.8T LLM inference with single 4GB GPU

fix(ci): use collaborator PAT for star history stargazers fetch

Yu Lie57c38165213
diff --git a/.github/workflows/star-history.yml b/.github/workflows/star-history.yml
index fadfad2..60a105f 100644
--- a/.github/workflows/star-history.yml
+++ b/.github/workflows/star-history.yml
@@ -5,6 +5,13 @@ name: Refresh Star History
# scripts/gen_star_history.py) instead of embedding the anonymous
# star-history.com SVG API, which is rate-limited and returns an empty chart
# for large repos. The README embeds the committed PNG, so it always renders.
+#
+# Since 2026-06-30 GitHub restricts GET /repos/{owner}/{repo}/stargazers to
+# admins/collaborators. The Actions GITHUB_TOKEN is an installation token and
+# gets 403, so this workflow needs a collaborator PAT in STAR_HISTORY_TOKEN:
+# fine-grained: Metadata (read) on this repo, or
+# classic: public_repo
+# gh secret set STAR_HISTORY_TOKEN
on:
schedule:
@@ -28,8 +35,13 @@ jobs:
- name: Generate star history charts (light + dark)
env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ # Collaborator/admin PAT; Actions GITHUB_TOKEN cannot list stargazers.
+ GITHUB_TOKEN: ${{ secrets.STAR_HISTORY_TOKEN }}
run: |
+ if [ -z "$GITHUB_TOKEN" ]; then
+ echo "::error::Missing secret STAR_HISTORY_TOKEN. Create a collaborator PAT (fine-grained Metadata:read, or classic public_repo) and run: gh secret set STAR_HISTORY_TOKEN"
+ exit 1
+ fi
python scripts/gen_star_history.py "${{ github.repository }}" assets/star-history.png light
python scripts/gen_star_history.py "${{ github.repository }}" assets/star-history-dark.png dark
diff --git a/scripts/gen_star_history.py b/scripts/gen_star_history.py
index cd84919..3fac25b 100644
--- a/scripts/gen_star_history.py
+++ b/scripts/gen_star_history.py
@@ -16,6 +16,7 @@ import json
import math
import os
import sys
+import urllib.error
import urllib.request
REPO = sys.argv[1] if len(sys.argv) > 1 else os.environ.get("REPO", "lyogavin/airllm")
@@ -36,8 +37,23 @@ def gh(url, accept="application/vnd.github+json"):
if TOKEN:
headers["Authorization"] = f"Bearer {TOKEN}"
req = urllib.request.Request(url, headers=headers)
- with urllib.request.urlopen(req, timeout=30) as r:
- return json.load(r)
+ try:
+ with urllib.request.urlopen(req, timeout=30) as r:
+ return json.load(r)
+ except urllib.error.HTTPError as e:
+ body = e.read().decode("utf-8", errors="replace")
+ try:
+ msg = json.loads(body).get("message", body)
+ except json.JSONDecodeError:
+ msg = body
+ hint = ""
+ if e.code == 403 and "stargazers" in url:
+ hint = (
+ "\nGitHub restricts /stargazers to admins/collaborators; the "
+ "Actions GITHUB_TOKEN cannot access it. Use a collaborator PAT "
+ "via the STAR_HISTORY_TOKEN secret."
+ )
+ raise SystemExit(f"GitHub API {e.code} for {url}: {msg}{hint}") from e
def main():