45 lines
2.1 KiB
YAML
45 lines
2.1 KiB
YAML
name: probe
|
|
# One-off: what can Time reach from a GitHub-hosted runner with no secrets?
|
|
on: workflow_dispatch
|
|
permissions:
|
|
contents: read
|
|
models: read
|
|
jobs:
|
|
probe:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 5
|
|
steps:
|
|
- name: GitHub Models catalog + one call
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
python3 - <<'PY'
|
|
import json, os, urllib.request, urllib.error
|
|
tok = os.environ["GH_TOKEN"]
|
|
h = {"Authorization": f"Bearer {tok}", "Accept": "application/vnd.github+json",
|
|
"X-GitHub-Api-Version": "2022-11-28"}
|
|
def call(url, body=None):
|
|
req = urllib.request.Request(url, headers={**h, "Content-Type": "application/json"},
|
|
data=json.dumps(body).encode() if body else None,
|
|
method="POST" if body else "GET")
|
|
try:
|
|
with urllib.request.urlopen(req, timeout=60) as r:
|
|
return r.status, r.headers.get("Content-Type"), r.read().decode(errors="replace")
|
|
except urllib.error.HTTPError as e:
|
|
return e.code, e.headers.get("Content-Type"), e.read().decode(errors="replace")
|
|
st, ct, txt = call("https://models.github.ai/catalog/models")
|
|
print("catalog:", st, ct, len(txt), "bytes")
|
|
try:
|
|
for m in json.loads(txt):
|
|
print(" ", m["id"], "|", m.get("rate_limit_tier"))
|
|
except Exception:
|
|
print(" raw:", txt[:300])
|
|
for model in ("openai/gpt-4.1-mini", "xai/grok-3-mini", "deepseek/deepseek-v3-0324", "meta/llama-4-scout-17b-16e-instruct"):
|
|
st, ct, txt = call("https://models.github.ai/inference/chat/completions",
|
|
{"model": model, "messages": [{"role": "user", "content": "Reply with exactly: ok"}]})
|
|
try:
|
|
print("inference", model, st, json.loads(txt)["choices"][0]["message"]["content"][:40])
|
|
except Exception:
|
|
print("inference", model, st, txt[:200])
|
|
PY
|