Generate Stats Images #460
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: [ master, main ] | |
| schedule: | |
| - cron: "5 0 * * *" | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Check out repository under $GITHUB_WORKSPACE, so the job can access it | |
| - uses: actions/checkout@v3 | |
| # Run using Python 3.8 for consistency and aiohttp | |
| - name: Set up Python 3.8 | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.8' | |
| architecture: 'x64' | |
| cache: 'pip' | |
| # Install dependencies with `pip` | |
| - name: Install requirements | |
| run: | | |
| python3 -m pip install --upgrade pip setuptools wheel | |
| python3 -m pip install -r requirements.txt | |
| # Generate all statistics images | |
| - name: Generate images | |
| run: | | |
| python3 --version | |
| python3 generate_images.py | |
| env: | |
| ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} | |
| GITHUB_ACTOR: ${{ github.actor }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| EXCLUDE_FORKED_REPOS: false | |
| # Optional secrets - Python code handles None/empty values gracefully | |
| EXCLUDED: ${{ secrets.EXCLUDED }} | |
| EXCLUDED_LANGS: ${{ secrets.EXCLUDED_LANGS }} | |
| GIT_EMAILS: ${{ secrets.GIT_EMAILS }} | |
| # Commit all changed files to the repository | |
| - name: Commit to the repo | |
| run: | | |
| git config --global user.name "AxelPCG/github-stats-modified" | |
| git config --global user.email "axelchepanski@hotmail.com" | |
| git add generated/ | |
| # Only commit if there are changes | |
| if git diff --staged --quiet; then | |
| echo "No changes to commit" | |
| else | |
| git commit -m 'Update generated files [skip ci]' || exit 1 | |
| git push || exit 1 | |
| fi |