Skip to content

Commit fa326a4

Browse files
Merge pull request anthropics#194 from anthropics/fix/expand-ci-notebook-coverage
fix(ci): expand CI coverage to all notebook directories
2 parents 0164f4b + cfb97d9 commit fa326a4

File tree

5 files changed

+26
-16
lines changed

5 files changed

+26
-16
lines changed

.github/workflows/claude-model-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
pull_request:
55
types: [opened, synchronize]
66
paths:
7-
- 'skills/**/*.ipynb'
7+
- '**/*.ipynb'
88
- '**.py'
99
- '**.md'
1010

.github/workflows/claude-notebook-review.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
pull_request:
55
types: [opened, synchronize]
66
paths:
7-
- 'skills/**/*.ipynb'
7+
- '**/*.ipynb'
88
- 'pyproject.toml'
99
- 'uv.lock'
1010
- 'scripts/**/*.py'

.github/workflows/links.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
pip install jupyter nbconvert
2828
mkdir -p temp_md
2929
30-
for nb in skills/**/*.ipynb; do
30+
for nb in $(find . -name "*.ipynb" -not -path "*/.*"); do
3131
echo "Converting: $nb"
3232
jupyter nbconvert --to markdown "$nb" \
3333
--output-dir=temp_md \

.github/workflows/notebook-quality.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ name: Notebook Quality Check
33
on:
44
pull_request:
55
paths:
6-
- 'skills/**/*.ipynb'
6+
- '**/*.ipynb'
77
- 'pyproject.toml'
88
- 'uv.lock'
99
push:
1010
branches: [main]
1111
paths:
12-
- 'skills/**/*.ipynb'
12+
- '**/*.ipynb'
1313

1414
permissions:
1515
contents: read
@@ -37,8 +37,8 @@ jobs:
3737
3838
- name: Lint notebooks with Ruff
3939
run: |
40-
uv run ruff check skills/**/*.ipynb --show-fixes || true
41-
uv run ruff format skills/**/*.ipynb --check || true
40+
uv run ruff check **/*.ipynb --show-fixes || true
41+
uv run ruff format **/*.ipynb --check || true
4242
4343
- name: Validate notebook structure
4444
run: |
@@ -54,9 +54,9 @@ jobs:
5454
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
5555
run: |
5656
mkdir -p test_outputs
57-
for notebook in skills/*/guide.ipynb; do
57+
for notebook in $(find . -name "*.ipynb" -not -path "*/.*" -not -path "*/test_outputs/*"); do
5858
echo "📓 Testing: $notebook"
59-
output_name=$(basename $(dirname "$notebook"))
59+
output_name=$(echo "$notebook" | sed 's|/|_|g' | sed 's|\.|_|g')
6060
# Use nbconvert to execute notebooks and save outputs
6161
uv run jupyter nbconvert --to notebook \
6262
--execute "$notebook" \
@@ -75,8 +75,8 @@ jobs:
7575
github.event.pull_request.author_association != 'OWNER'
7676
run: |
7777
echo "🔒 Running in mock mode for external contributor"
78-
79-
for notebook in skills/*/guide.ipynb; do
78+
79+
for notebook in $(find . -name "*.ipynb" -not -path "*/.*"); do
8080
echo "📓 Validating structure: $notebook"
8181
uv run python -m nbformat.validator "$notebook"
8282
done

scripts/validate_notebooks.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,30 @@ def validate_notebook(path: Path) -> list:
3232
def main():
3333
"""Check all notebooks."""
3434
has_issues = False
35-
36-
for notebook in Path('skills').glob('**/*.ipynb'):
35+
36+
# Find all notebooks in the repository
37+
notebooks = list(Path('.').glob('**/*.ipynb'))
38+
# Exclude hidden directories and common build directories
39+
notebooks = [nb for nb in notebooks if not any(part.startswith('.') for part in nb.parts)]
40+
notebooks = [nb for nb in notebooks if 'test_outputs' not in nb.parts]
41+
42+
if not notebooks:
43+
print("⚠️ No notebooks found to validate")
44+
sys.exit(0)
45+
46+
for notebook in notebooks:
3747
issues = validate_notebook(notebook)
3848
if issues:
3949
has_issues = True
4050
print(f"\n{notebook}:")
4151
for issue in issues:
4252
print(f" - {issue}")
43-
53+
4454
if not has_issues:
45-
print("✅ All notebooks validated successfully")
55+
print(f"✅ All {len(notebooks)} notebooks validated successfully")
4656
else:
4757
print("\n⚠️ Found issues that should be fixed in a separate PR")
48-
58+
4959
# For POC, return 0 even with issues to show detection without blocking
5060
sys.exit(0)
5161

0 commit comments

Comments
 (0)