Update Contributors #157
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: Update Contributors | |
| on: | |
| schedule: | |
| # Run daily at 2 AM UTC | |
| - cron: '0 2 * * *' | |
| workflow_dispatch: # Allow manual trigger | |
| push: | |
| branches: [ main ] | |
| paths-ignore: | |
| - 'CONTRIBUTORS.md' | |
| jobs: | |
| update-contributors: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.CONTRIBUTOR_TOKEN }} | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.9' | |
| - name: Install dependencies | |
| run: | | |
| pip install requests | |
| - name: Run contributor aggregation | |
| env: | |
| CONTRIBUTOR_TOKEN: ${{ secrets.CONTRIBUTOR_TOKEN }} | |
| run: | | |
| python scripts/update_contributors.py | |
| - name: Check for changes | |
| id: verify-changed-files | |
| run: | | |
| if [ -n "$(git status --porcelain)" ]; then | |
| echo "changed=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "changed=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Commit changes | |
| if: steps.verify-changed-files.outputs.changed == 'true' | |
| env: | |
| CONTRIBUTOR_TOKEN: ${{ secrets.CONTRIBUTOR_TOKEN }} | |
| run: | | |
| git config --local user.email "action@github.com" | |
| git config --local user.name "GitHub Action" | |
| git add CONTRIBUTORS.md | |
| git commit -m "🤖 Auto-update CONTRIBUTORS.md [skip ci]" | |
| git remote set-url origin https://x-access-token:${CONTRIBUTOR_TOKEN}@github.com/${{ github.repository }}.git | |
| git push origin HEAD |