traffic-metrics #104
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: traffic-metrics | |
| on: | |
| schedule: | |
| - cron: "0 1 * * *" | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| collect: | |
| runs-on: ubuntu-latest | |
| env: | |
| TRAFFIC_TOKEN: ${{ secrets.TRAFFIC_TOKEN || secrets.GITHUB_TOKEN }} | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install matplotlib requests | |
| - name: Collect traffic metrics | |
| env: | |
| GH_TOKEN: ${{ env.TRAFFIC_TOKEN }} | |
| GITHUB_TOKEN: ${{ env.TRAFFIC_TOKEN }} | |
| REPO_NAME: ${{ github.repository }} | |
| run: | | |
| python .github/scripts/traffic_metrics.py --repo "${REPO_NAME}" --output-dir output/traffic --readme README.md | |
| - name: Commit traffic artifacts | |
| uses: stefanzweifel/git-auto-commit-action@v5 | |
| with: | |
| commit_message: "chore: update traffic metrics" | |
| file_pattern: | | |
| output/traffic/* | |
| README.md |