Skip to content

Adjust claude cron to real-world inference challenges #110

Adjust claude cron to real-world inference challenges

Adjust claude cron to real-world inference challenges #110

Workflow file for this run

name: Claude Code
on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
issues:
types: [opened, assigned]
pull_request_review:
types: [submitted]
jobs:
claude:
if: >
github.actor == 'kunal-mansukhani' ||
github.actor == 'ishaan-arya' ||
github.actor == 'shxjames'
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
issues: write
id-token: write
actions: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Checkout PR branch (handles forks)
id: pr-checkout
if: github.event.issue.pull_request || github.event.pull_request
env:
GH_TOKEN: ${{ github.token }}
REPO: ${{ github.repository }}
PR_NUMBER: ${{ github.event.issue.number || github.event.pull_request.number }}
run: |
# Check if PR is from a fork
IS_FORK=$(gh pr view $PR_NUMBER --repo "$REPO" --json isCrossRepository -q .isCrossRepository)
echo "is_fork=$IS_FORK" >> $GITHUB_OUTPUT
if [ "$IS_FORK" = "true" ]; then
# Get fork info for context
FORK_OWNER=$(gh pr view $PR_NUMBER --repo "$REPO" --json headRepositoryOwner -q .headRepositoryOwner.login)
FORK_BRANCH=$(gh pr view $PR_NUMBER --repo "$REPO" --json headRefName -q .headRefName)
echo "fork_owner=$FORK_OWNER" >> $GITHUB_OUTPUT
echo "fork_branch=$FORK_BRANCH" >> $GITHUB_OUTPUT
# Add fork as a separate remote to fetch the code
FORK_URL=$(gh pr view $PR_NUMBER --repo "$REPO" --json headRepositoryOwner,headRepository -q '"https://github.com/\(.headRepositoryOwner.login)/\(.headRepository.name).git"')
git remote add fork "$FORK_URL"
git fetch fork "$FORK_BRANCH"
git checkout -b "pr-$PR_NUMBER-$FORK_BRANCH" "fork/$FORK_BRANCH"
# origin stays pointing to main repo so Claude can push there
else
gh pr checkout $PR_NUMBER --repo "$REPO"
fi
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: |
pip install pre-commit requests websocket-client
pre-commit install
- name: Run Claude Code
id: claude
uses: anthropics/claude-code-action@v1
env:
SERVICE_URL: ${{ secrets.LEETGPU_SERVICE_URL }}
LEETGPU_API_KEY: ${{ secrets.LEETGPU_API_KEY }}
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
claude_args: "--model claude-sonnet-4-6"
settings: |
{
"permissions": {
"allow": ["Bash", "Read", "Write", "Edit", "Glob", "Grep", "WebFetch", "WebSearch", "Task"]
}
}
additional_permissions: |
actions: read
prompt: |
IMPORTANT - Fork PR Handling:
This PR is from a fork: ${{ steps.pr-checkout.outputs.is_fork == 'true' }}
If this is a fork PR (is_fork=true):
- You CANNOT push to the fork's branch directly
- Instead, when you need to commit changes:
1. Create a new branch from the current code: git checkout -b claude/pr-${{ github.event.issue.number || github.event.pull_request.number }}-fixes
2. Make your commits on this new branch
3. Push to origin (the main repo): git push -u origin claude/pr-${{ github.event.issue.number || github.event.pull_request.number }}-fixes
4. Create a NEW PR using: gh pr create --base main --title "Fixes for PR #${{ github.event.issue.number || github.event.pull_request.number }}" --body "This PR contains fixes for the fork PR #${{ github.event.issue.number || github.event.pull_request.number }} by @${{ steps.pr-checkout.outputs.fork_owner }}\n\nOriginal branch: ${{ steps.pr-checkout.outputs.fork_branch }}"
5. Comment on the original PR (#${{ github.event.issue.number || github.event.pull_request.number }}) linking to your new PR
If this is NOT a fork PR (is_fork=false):
- You can commit and push directly to the PR branch as normal
IMPORTANT - Challenge Validation:
When creating or reviewing PRs that add or modify challenges, you MUST:
1. Read CLAUDE.md and verify every item in the "Checklist" section
2. Write a correct CUDA solution in the challenge's solution/solution.cu directory
3. Run: python scripts/run_challenge.py <challenge_dir> --language cuda --action run
4. Verify all functional tests pass and the performance test completes
5. Do NOT commit the solution file to the PR
6. You may only run run_challenge.py 5 times per session — verify your solution logic before submitting