mirror of
https://github.com/open-jarvis/OpenJarvis.git
synced 2026-07-30 19:02:16 +00:00
- openjarvis.__version__ now comes from importlib.metadata.version("openjarvis")
instead of a hardcoded string, so it stays in sync with pyproject.toml on every
release. Tests assert against openjarvis.__version__ rather than a literal.
- Bump actions/checkout@v4 → @v6 and astral-sh/setup-uv@v4 → @v8 across every
workflow ahead of the 2026-06-02 Node.js 20 deprecation on GitHub Actions runners.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
87 lines
2.6 KiB
YAML
87 lines
2.6 KiB
YAML
name: Track Git Clones
|
|
|
|
on:
|
|
schedule:
|
|
- cron: '0 6 * * *' # Daily at 06:00 UTC
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
track-clones:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
token: ${{ secrets.TRAFFIC_TOKEN }}
|
|
|
|
- name: Fetch clone traffic
|
|
env:
|
|
GH_TOKEN: ${{ secrets.TRAFFIC_TOKEN }}
|
|
run: |
|
|
gh api repos/${{ github.repository }}/traffic/clones > /tmp/traffic.json
|
|
|
|
- name: Update accumulated data
|
|
run: |
|
|
python3 - <<'PYEOF'
|
|
import json
|
|
from datetime import datetime, timezone
|
|
|
|
# Load current traffic data from API
|
|
with open("/tmp/traffic.json") as f:
|
|
traffic = json.load(f)
|
|
|
|
# Load accumulated data
|
|
data_path = ".github/clone-stats/clone-data.json"
|
|
with open(data_path) as f:
|
|
accumulated = json.load(f)
|
|
|
|
daily = accumulated.get("daily", {})
|
|
|
|
# Merge new daily entries (keyed by date to avoid double-counting)
|
|
for entry in traffic.get("clones", []):
|
|
date_key = entry["timestamp"][:10] # "2026-03-26"
|
|
daily[date_key] = entry["count"] # total clones, not unique
|
|
|
|
# Recalculate total from all daily data
|
|
total = sum(daily.values())
|
|
|
|
# Update accumulated data
|
|
accumulated["daily"] = dict(sorted(daily.items()))
|
|
accumulated["total_clones"] = total
|
|
accumulated["last_updated"] = datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
|
|
|
|
with open(data_path, "w") as f:
|
|
json.dump(accumulated, f, indent=2)
|
|
f.write("\n")
|
|
|
|
# Update shields.io endpoint badge
|
|
badge = {
|
|
"schemaVersion": 1,
|
|
"label": "Git Clones",
|
|
"message": f"{total:,}",
|
|
"color": "green",
|
|
"namedLogo": "git"
|
|
}
|
|
|
|
with open(".github/clone-stats/badge.json", "w") as f:
|
|
json.dump(badge, f, indent=2)
|
|
f.write("\n")
|
|
|
|
print(f"Updated: {total:,} total clones across {len(daily)} days")
|
|
PYEOF
|
|
|
|
- name: Commit and push
|
|
run: |
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
git add .github/clone-stats/
|
|
if git diff --cached --quiet; then
|
|
echo "No changes to commit"
|
|
else
|
|
git commit -m "chore: update clone traffic data [skip ci]"
|
|
git push
|
|
fi
|