Update Quiz Leaderboard #51
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 Quiz Leaderboard | |
| on: | |
| issue_comment: | |
| types: [created] | |
| schedule: | |
| # Run daily at 2 AM UTC | |
| - cron: '0 2 * * *' | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| issues: write | |
| jobs: | |
| update-leaderboard: | |
| name: Update Quiz Leaderboard | |
| runs-on: ubuntu-latest | |
| if: | | |
| (github.event_name == 'issue_comment' && contains(github.event.issue.labels.*.name, 'quiz-leaderboard')) || | |
| github.event_name == 'schedule' || | |
| github.event_name == 'workflow_dispatch' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.10' | |
| - name: Install dependencies | |
| run: | | |
| pip install PyGithub==2.* | |
| - name: Update leaderboard | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| ISSUE_NUMBER: ${{ github.event.issue.number || github.event.inputs.issue_number }} | |
| REPOSITORY: ${{ github.repository }} | |
| EVENT_NAME: ${{ github.event_name }} | |
| run: | | |
| python scripts/update_quiz_leaderboard.py |