-
Notifications
You must be signed in to change notification settings - Fork 3
Add GPT-5-mini auto-solver for daily LeetCode problems #41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: jeremymanning <9030494+jeremymanning@users.noreply.github.com>
Co-authored-by: jeremymanning <9030494+jeremymanning@users.noreply.github.com>
Co-authored-by: jeremymanning <9030494+jeremymanning@users.noreply.github.com>
|
@copilot Since we can't test the key elements of this implementation here (i.e., fetching the leetcode problem doesn't work because we don't have access to external sites, and we can't access repository secrets to get the openai API key), add a comment ot the pull request with instructions for manually testing the solution before I merge. |
Manual Testing InstructionsSince this PR cannot be fully tested in the PR environment, follow these steps to test before merging: Prerequisites
Testing Steps1. Manual Workflow Trigger Test
2. Verify Generated Solution
3. Validate Solution Quality
4. Test Schedule (Optional)
Expected Output StructureTroubleshooting
|
jeremymanning
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
Implements automated solution generation for daily LeetCode problems using OpenAI's GPT-5-mini, running at 00:01 UTC.
Changes
.github/workflows/auto_solver.yml: Daily workflow with explicitcontents: writepermissionsauto_solver.py: Fetches problem via LeetCode GraphQL API, generates solution with GPT-5-mini, saves asproblems/{ID}/gpt5-mini.mdREADME.md: Added auto-solver documentationGenerated Solution Format
Solutions follow existing template structure:
Configuration Required
Set
OPENAI_API_KEYrepository secret before merge. Workflow can also be triggered manually via Actions UI.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
leetcode.comimport requests
import json
Test fetching the daily problem
leetcode_api_url = 'REDACTED'
daily_challenge_query = {
'query': '''query questionOfToday {
activeDailyCodingChallengeQuestion {
date
link
question {
questionFrontendId
title
titleSlug
difficulty
content
}
}
}''',
'operationName': 'questionOfToday'
}
response = requests.post(leetcode_api_url, json=daily_challenge_query)
data = response.json()
if 'data' in data and 'activeDailyCodingChallengeQuestion' in data['data']:
question = data['data']['activeDailyCodingChallengeQuestion']['question']
print(f'✓ Successfully fetched daily problem:')
print(f' Problem ID: {question["questionFrontendId"]}')
print(f' Title: {question["title"]}')
print(f' Difficulty: {question["difficulty"]}')
print(f' Content length: {len(question["content"])} characters')
else:
print('✗ Failed to fetch problem')
print(json.dumps(data, indent=2))` (dns block)
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.