Update Leaderboard #8762
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 Leaderboard | |
| on: | |
| push: | |
| branches: ["main"] | |
| pull_request: | |
| types: [closed] | |
| branches: ["main"] | |
| schedule: | |
| # Run every 10 minutes | |
| - cron: '*/10 * * * *' | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| issues: read | |
| pull-requests: read | |
| jobs: | |
| update-leaderboard: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18' | |
| - name: Generate leaderboard | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| REPO_OWNER: ${{ github.repository_owner }} | |
| REPO_NAME: ${{ github.event.repository.name }} | |
| run: | | |
| node .github/scripts/generate-leaderboard.js | |
| - name: Commit and push changes | |
| run: | | |
| git config --local user.email "[email protected]" | |
| git config --local user.name "GitHub Action" | |
| git add LEADERBOARD.md | |
| if git diff --staged --quiet; then | |
| echo "No changes to commit" | |
| else | |
| git commit -m "Auto-update LEADERBOARD.md [skip ci]" | |
| git push | |
| fi |