Skip to content

Update Contributors #53

Update Contributors

Update Contributors #53

name: Update Contributors
on:
schedule:
- cron: "0 0 * * *" # Run daily at midnight UTC
workflow_dispatch: # Allow manual trigger
jobs:
update-contributors:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: latest
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: "pnpm"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Update contributors
run: pnpm run update-contributors
- name: Check for changes
id: check
run: |
git diff --quiet README.md || echo "changes=true" >> $GITHUB_OUTPUT
- name: Create Pull Request
if: steps.check.outputs.changes == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Configure git
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
# Create a new branch
BRANCH_NAME="update-contributors-${{ github.run_number }}"
git checkout -b "$BRANCH_NAME"
# Commit the changes
git add README.md
git commit -m "chore: update contributors list"
# Push the branch
git push -u origin "$BRANCH_NAME"
# Create the PR using GitHub CLI
gh pr create \
--title "chore: update contributors list" \
--body "## Automated Contributors Update
This PR automatically updates the contributors list based on recent activity.
Generated by the daily contributors update workflow." \
--label "documentation" \
--label "automated" \
--base main \
--head "$BRANCH_NAME"