Skip to content

Update Contributors #136

Update Contributors

Update Contributors #136

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