Generate Stats Images #271
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: Generate Stats Images | |
| on: | |
| push: | |
| branches: [ main ] | |
| schedule: | |
| - cron: "0 0 * * *" | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| architecture: 'x64' | |
| - uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pip- | |
| - name: Install dependencies | |
| run: | | |
| python3 -m pip install --upgrade pip setuptools wheel | |
| python3 -m pip install -r requirements.txt | |
| - name: Generate images | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.TOKEN }} | |
| GITHUB_USERNAME: ${{ secrets.USERNAME }} | |
| run: | | |
| python3 --version | |
| python3 main.py | |
| - name: Commit and push generated SVG | |
| run: | | |
| git config --global user.name "github-stats[bot]" | |
| git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add . | |
| git commit -m 'temp commit' || echo | |
| git checkout output 2>/dev/null || git checkout --orphan output && git rm -rf . && git checkout main -- generated/ | |
| git commit -m 'Update generated files' || echo | |
| git push origin output -f |