|
41 | 41 | uv run ruff format **/*.ipynb --check || true |
42 | 42 | |
43 | 43 | - name: Validate notebook structure |
| 44 | + id: validate |
44 | 45 | run: | |
45 | | - uv run python scripts/validate_notebooks.py |
46 | | - |
| 46 | + uv run python scripts/validate_notebooks.py | tee validation_output.txt |
| 47 | + # Check if validation found issues |
| 48 | + if grep -q "❌" validation_output.txt; then |
| 49 | + echo "has_issues=true" >> $GITHUB_OUTPUT |
| 50 | + exit 1 |
| 51 | + else |
| 52 | + echo "has_issues=false" >> $GITHUB_OUTPUT |
| 53 | + fi |
| 54 | + continue-on-error: true |
| 55 | + |
| 56 | + - name: Summarize validation issues with Claude |
| 57 | + if: github.event_name == 'pull_request' && steps.validate.outputs.has_issues == 'true' |
| 58 | + uses: anthropics/claude-code-action@v1 |
| 59 | + with: |
| 60 | + anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} |
| 61 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 62 | + prompt: | |
| 63 | + The notebook validation found these issues: |
| 64 | +
|
| 65 | + ``` |
| 66 | + $(cat validation_output.txt) |
| 67 | + ``` |
| 68 | +
|
| 69 | + Create a helpful PR comment that: |
| 70 | + - Summarizes the validation issues found |
| 71 | + - Groups similar issues together (e.g., "7 notebooks have empty cells") |
| 72 | + - Explains why empty cells are problematic and how to fix them (delete them or add content) |
| 73 | + - If there are error outputs, explain they should be cleared before committing |
| 74 | + - Uses friendly, constructive language |
| 75 | + - Includes specific notebook names and cell numbers for reference |
| 76 | +
|
| 77 | + Format as a nice GitHub comment with markdown. Use emoji sparingly for clarity. |
| 78 | + Post using: gh pr comment $PR_NUMBER --body "your comment" |
| 79 | + claude_args: | |
| 80 | + --allowedTools "Bash(gh pr comment:*),Bash(cat:*),Read" |
| 81 | + env: |
| 82 | + PR_NUMBER: ${{ github.event.pull_request.number }} |
| 83 | + |
47 | 84 | # Only run API tests on main branch or for maintainers (costs money) |
48 | 85 | - name: Execute notebooks (API Testing) |
49 | 86 | if: | |
|
0 commit comments