Count commits from all visible repos #190
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 ] | |
| schedule: | |
| - cron: "5 0 * * *" | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| env: | |
| GENERATE_EXPERIMENTAL: true | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Check out repository under $GITHUB_WORKSPACE, so the job can access it | |
| - uses: actions/checkout@v6 | |
| # Run using Python 3.8 for consistency and aiohttp | |
| - name: Set up Python 3.8 | |
| uses: actions/setup-python@v6 | |
| 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 | |
| # Run regression tests before making live API calls | |
| - name: Run tests | |
| run: | | |
| python3 -m unittest test_github_stats.py | |
| # Generate all statistics images | |
| - name: Generate images | |
| run: | | |
| python3 --version | |
| python3 generate_images.py | |
| env: | |
| ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| EXCLUDED: ${{ secrets.EXCLUDED }} | |
| EXCLUDED_LANGS: ${{ secrets.EXCLUDED_LANGS }} | |
| EXCLUDE_FORKED_REPOS: false | |
| # Upload the structured report without committing it | |
| - name: Upload run report | |
| if: always() | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: github-stats-run-report | |
| path: run-report.json | |
| if-no-files-found: ignore | |
| # Commit all changed files to the repository | |
| - name: Commit to the repo | |
| run: | | |
| python3 -c "import generate_images; generate_images.validate_generated_output()" | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add generated | |
| if git diff --cached --quiet --exit-code; then | |
| echo "No generated file changes to commit." | |
| else | |
| git commit -m 'Update generated files' | |
| git push | |
| fi |