Auto-solve Daily LeetCode Problem #5
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: Auto-solve Daily LeetCode Problem | |
| on: | |
| schedule: | |
| - cron: '1 0 * * *' # Runs daily at 00:01 UTC (1 minute after daily problems are released) | |
| workflow_dispatch: # Allows for manual triggering | |
| jobs: | |
| auto-solve: | |
| runs-on: ubuntu-latest | |
| if: github.repository_owner == 'ContextLab' # only run if on the ContextLab (source) repository! | |
| permissions: | |
| contents: write # Required to push commits back to the repository | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.11' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install requests openai | |
| - name: Run auto-solver | |
| env: | |
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
| run: | | |
| python auto_solver.py | |
| - name: Commit and push changes | |
| uses: stefanzweifel/git-auto-commit-action@v4 | |
| with: | |
| commit_message: "Auto-solve daily LeetCode problem using GPT-5-mini" | |
| branch: main | |
| file_pattern: problems/*/gpt5-mini.md |