Update contributors #36
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: | |
| push: | |
| branches: | |
| - main | |
| - master | |
| workflow_dispatch: | |
| schedule: | |
| # 每天北京时间 0:00(UTC 16:00)同步贡献者列表 | |
| - cron: "0 16 * * *" | |
| permissions: | |
| contents: write | |
| jobs: | |
| update-contributors: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| - name: Generate contributors.json | |
| run: node scripts/generate-contributors.js | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Commit and push if changed | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add assets/contributors.json | |
| if git diff --staged --quiet; then | |
| echo "contributors.json unchanged" | |
| exit 0 | |
| fi | |
| git commit -m "chore: update contributors.json [skip ci]" | |
| git push |