Skip to content

Commit 3ab4f7d

Browse files
committed
feat: add Claude-powered PR review workflows
- Add claude-notebook-review.yml for intelligent code review - Add claude-link-review.yml for link quality checks - Update notebook-quality.yml to properly capture test outputs - Use anthropics/claude-code-action@beta like docs repo
1 parent 13111dc commit 3ab4f7d

File tree

3 files changed

+130
-3
lines changed

3 files changed

+130
-3
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Claude Link Review
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize]
6+
paths:
7+
- '**.md'
8+
- '**.mdx'
9+
- '**.ipynb'
10+
- 'README.md'
11+
12+
jobs:
13+
link-review:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
17+
pull-requests: write
18+
id-token: write
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0
24+
25+
- name: Run Claude Link Review
26+
uses: anthropics/claude-code-action@beta
27+
with:
28+
use_sticky_comment: true
29+
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
30+
github_token: ${{ secrets.GITHUB_TOKEN }}
31+
timeout_minutes: "30"
32+
allowed_bots: "*"
33+
direct_prompt: |
34+
Review the links in the changed files and check for potential issues:
35+
36+
## Link Quality Checks
37+
1. **Broken Links**: Identify any links that might be broken or malformed
38+
2. **Outdated Links**: Check for links to deprecated resources or old documentation
39+
3. **Security**: Ensure no links to suspicious or potentially harmful sites
40+
4. **Best Practices**:
41+
- Links should use HTTPS where possible
42+
- Internal links should use relative paths
43+
- External links should be to stable, reputable sources
44+
45+
## Specific Checks for Anthropic Content
46+
- Links to Claude documentation should point to the latest versions
47+
- API documentation links should be current
48+
- Model documentation should reference current models, not deprecated ones
49+
- GitHub links should use the correct repository paths
50+
51+
## Report Format
52+
Provide a clear summary with:
53+
- ✅ Valid and well-formed links
54+
- ⚠️ Links that might need attention (e.g., HTTP instead of HTTPS)
55+
- ❌ Broken or problematic links that must be fixed
56+
57+
If all links look good, provide a brief confirmation.
58+
59+
Format your response as a helpful PR review comment.
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Claude Notebook Review
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize]
6+
paths:
7+
- 'skills/**/*.ipynb'
8+
- 'pyproject.toml'
9+
- 'uv.lock'
10+
- 'scripts/**/*.py'
11+
12+
jobs:
13+
notebook-review:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
17+
pull-requests: write
18+
id-token: write
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0
24+
25+
- name: Run Claude Notebook Review
26+
uses: anthropics/claude-code-action@beta
27+
with:
28+
use_sticky_comment: true
29+
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
30+
github_token: ${{ secrets.GITHUB_TOKEN }}
31+
timeout_minutes: "30"
32+
allowed_bots: "*"
33+
direct_prompt: |
34+
Review the changes to Jupyter notebooks and Python scripts in this PR. Please check for:
35+
36+
## Model Usage
37+
Check that all Claude model references use current, public models:
38+
- claude-3-5-haiku-latest (recommended for testing)
39+
- claude-3-5-sonnet-latest (for complex tasks)
40+
- Avoid deprecated models like claude-3-haiku-20240307, old Sonnet 3.5 versions
41+
42+
## Code Quality
43+
- Python code follows PEP 8 conventions
44+
- Proper error handling
45+
- Clear variable names and documentation
46+
- No hardcoded API keys (use os.getenv("ANTHROPIC_API_KEY"))
47+
48+
## Notebook Structure
49+
- Clear markdown explanations between code cells
50+
- Logical flow from simple to complex
51+
- Outputs preserved for educational value
52+
- Dependencies properly imported
53+
54+
## Security
55+
- No exposed secrets or API keys
56+
- Safe handling of user inputs
57+
- Appropriate use of environment variables
58+
59+
Provide a clear summary with:
60+
- ✅ What looks good
61+
- ⚠️ Suggestions for improvement
62+
- ❌ Critical issues that must be fixed
63+
64+
Format your response as a helpful PR review comment.

.github/workflows/notebook-quality.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ on:
1313

1414
permissions:
1515
contents: read
16+
pull-requests: write
1617

1718
jobs:
1819
validate-notebooks:
@@ -59,14 +60,17 @@ jobs:
5960
env:
6061
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
6162
run: |
63+
mkdir -p test_outputs
6264
for notebook in skills/*/guide.ipynb; do
6365
echo "📓 Testing: $notebook"
64-
# Use nbconvert to execute notebooks
66+
output_name=$(basename $(dirname "$notebook"))
67+
# Use nbconvert to execute notebooks and save outputs
6568
uv run jupyter nbconvert --to notebook \
6669
--execute "$notebook" \
6770
--ExecutePreprocessor.kernel_name=python3 \
6871
--ExecutePreprocessor.timeout=120 \
69-
--stdout > /dev/null \
72+
--output "test_outputs/${output_name}_executed.ipynb" \
73+
--output-dir=. \
7074
|| echo "⚠️ Failed: $notebook"
7175
done
7276
@@ -90,4 +94,4 @@ jobs:
9094
with:
9195
name: notebook-test-outputs-py${{ matrix.python-version }}
9296
path: test_outputs/
93-
retention-days: 7
97+
retention-days: 7

0 commit comments

Comments
 (0)