Files
claude-cookbooks/.github/workflows/claude-notebook-review.yml
Alex Notov 7938498146 refactor: simplify model validation to use Claude AI
Major simplification of CI/CD:
- Remove complex Python model validation scripts (400+ lines)
- Let Claude handle model validation intelligently via GitHub Actions
- Claude fetches latest models from docs.anthropic.com/en/docs/about-claude/models/overview.md
- Add comprehensive notebook validation script for local testing
  - Interactive dashboard with progress tracking
  - Auto-fix for deprecated models
  - GitHub issue export format
  - Idempotent with state persistence
- Simplify CI to use single Python version (3.11)
- Update workflows to use Claude for all intelligent validation

Benefits:
- No more hardcoded model lists to maintain
- Claude understands context (e.g., educational examples)
- 50% faster CI (removed matrix strategy)
- Single source of truth for models (docs site)
2025-09-07 17:27:34 -06:00

72 lines
2.8 KiB
YAML

name: Claude Notebook Review
on:
pull_request:
types: [opened, synchronize]
paths:
- 'skills/**/*.ipynb'
- 'pyproject.toml'
- 'uv.lock'
- 'scripts/**/*.py'
jobs:
notebook-review:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Run Claude Notebook Review
uses: anthropics/claude-code-action@beta
with:
use_sticky_comment: true
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
github_token: ${{ secrets.GITHUB_TOKEN }}
timeout_minutes: "30"
allowed_bots: "*"
direct_prompt: |
Review the changes to Jupyter notebooks and Python scripts in this PR. Please check for:
## Model Usage
Verify all Claude model references against the current list at:
https://docs.anthropic.com/en/docs/about-claude/models/overview.md
- Flag any deprecated models (older Sonnet 3.5, Opus 3 versions)
- Flag any internal/non-public model names
- Suggest current alternatives when issues found
- Recommend aliases ending in -latest for stability
## Code Quality
- Python code follows PEP 8 conventions
- Proper error handling
- Clear variable names and documentation
- No hardcoded API keys (use os.getenv("ANTHROPIC_API_KEY"))
## Notebook Structure
- Clear introduction explaining what the notebook demonstrates and why it's useful
- Configuration instructions (how to set up API keys, install dependencies, etc.)
- Connecting explanations between cells that help users understand the flow
- Clear markdown explanations between code cells
- Logical flow from simple to complex
- Outputs preserved for educational value
- Dependencies properly imported
## Security
- Check for any hardcoded API keys or secrets (not just Anthropic keys)
- Ensure all sensitive credentials use environment variables (os.environ, getenv, etc.)
- Flag any potential secret patterns (tokens, passwords, private keys)
- Note: Educational examples showing "what not to do" are acceptable if clearly marked
- Safe handling of user inputs
- Appropriate use of environment variables
Provide a clear summary with:
- ✅ What looks good
- ⚠️ Suggestions for improvement
- ❌ Critical issues that must be fixed
Format your response as a helpful PR review comment.