Sync Data #85
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Sync Data | |
| on: | |
| schedule: | |
| - cron: "0 6 * * *" # Daily at 6 AM UTC | |
| workflow_dispatch: | |
| jobs: | |
| sync: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| version: "latest" | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install dependencies | |
| run: uv sync | |
| - name: Sync PyPI stats from ClickPy | |
| run: uv run python scripts/sync_stats_clickpy.py | |
| - name: Sync GitHub profile data | |
| run: uv run python scripts/sync_github.py | |
| - name: Generate manifest | |
| run: uv run python scripts/generate_manifest.py | |
| - name: Commit and push | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| # Pull first so we rebase on any remote changes before committing. | |
| # --autostash handles the (unlikely) case of uncommitted local changes. | |
| git pull --rebase --autostash | |
| git add static/data/ | |
| git diff --staged --quiet || git commit -m "Update data $(date +%Y-%m-%d)" | |
| git push |