name: Update Language Statistics on: push: branches: - main - master paths: - 'README.md' workflow_dispatch: jobs: update-stats: runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 with: fetch-depth: 0 - name: Set up Python uses: actions/setup-python@v5 with: python-version: '3.x' - name: Generate language statistics run: python3 .github/scripts/generate_stats.py - name: Check for changes id: git-check run: | git diff --exit-code STATS-main.md || echo "changed=true" >> $GITHUB_OUTPUT - name: Commit and push if changed if: steps.git-check.outputs.changed == 'true' run: | git config --local user.email "github-actions[bot]@users.noreply.github.com" git config --local user.name "github-actions[bot]" git add STATS-main.md git commit -m "Auto-update language statistics [skip ci]" git push