Collect GitHub Stats #13
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: Collect GitHub Stats | |
| on: | |
| schedule: | |
| # Daily at 23:00 UTC. The 14-day Traffic API window forgives missed runs. | |
| - cron: "0 23 * * *" | |
| workflow_dispatch: {} | |
| concurrency: | |
| group: collect | |
| cancel-in-progress: false | |
| jobs: | |
| collect: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| cache: pip | |
| - run: pip install -r requirements.txt | |
| - name: Collect | |
| env: | |
| GH_TRAFFIC_TOKEN: ${{ secrets.GH_TRAFFIC_TOKEN }} | |
| INCLUDE_FORKS: "false" | |
| INCLUDE_ARCHIVED: "false" | |
| INCLUDE_PRIVATE: "false" | |
| run: python collect.py | |
| - name: Commit & push | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add data/ docs/data/ docs/index.html | |
| if git diff --cached --quiet; then | |
| echo "no changes" | |
| else | |
| git commit -m "data: $(date -u +%Y-%m-%d)" | |
| git push | |
| fi |