Adds all cookbooks for Opus 4.5 #16
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Notebook Diff Comment | |
| on: | |
| pull_request: | |
| paths: | |
| - '**/*.ipynb' | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| jobs: | |
| post-notebook-diff: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Need full history to diff against base | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| with: | |
| enable-cache: true | |
| - name: Set up Python 3.11 | |
| run: uv python install 3.11 | |
| - name: Get changed notebooks | |
| id: changed-notebooks | |
| run: | | |
| # Get the base branch (usually main) | |
| BASE_SHA=${{ github.event.pull_request.base.sha }} | |
| HEAD_SHA=${{ github.event.pull_request.head.sha }} | |
| # Find all changed .ipynb files | |
| CHANGED_NOTEBOOKS=$(git diff --name-only $BASE_SHA $HEAD_SHA | grep '\.ipynb$' || true) | |
| if [ -z "$CHANGED_NOTEBOOKS" ]; then | |
| echo "No notebooks changed" | |
| echo "has_changes=false" >> $GITHUB_OUTPUT | |
| else | |
| echo "Changed notebooks:" | |
| echo "$CHANGED_NOTEBOOKS" | |
| echo "has_changes=true" >> $GITHUB_OUTPUT | |
| # Save to file for next step | |
| echo "$CHANGED_NOTEBOOKS" > changed_notebooks.txt | |
| fi | |
| - name: Generate notebook diffs | |
| if: steps.changed-notebooks.outputs.has_changes == 'true' | |
| run: | | |
| BASE_SHA=${{ github.event.pull_request.base.sha }} | |
| HEAD_SHA=${{ github.event.pull_request.head.sha }} | |
| # Create output file | |
| echo "# Notebook Changes" > diff_comment.md | |
| echo "" >> diff_comment.md | |
| echo "This PR modifies the following notebooks:" >> diff_comment.md | |
| echo "" >> diff_comment.md | |
| # Process each changed notebook | |
| while IFS= read -r notebook; do | |
| if [ -z "$notebook" ]; then | |
| continue | |
| fi | |
| echo "Processing: $notebook" | |
| echo "## 📓 \`$notebook\`" >> diff_comment.md | |
| echo "" >> diff_comment.md | |
| echo "<details>" >> diff_comment.md | |
| echo "<summary>View diff</summary>" >> diff_comment.md | |
| echo "" >> diff_comment.md | |
| echo '```diff' >> diff_comment.md | |
| # Generate diff (suppress errors if file doesn't exist in base) | |
| # Ignore metadata, attachments, IDs, and other non-content changes | |
| uvx --from nbdime nbdiff --no-color -A -M -I -D \ | |
| $BASE_SHA $HEAD_SHA "$notebook" 2>/dev/null >> diff_comment.md || echo "New file" >> diff_comment.md | |
| echo '```' >> diff_comment.md | |
| echo "" >> diff_comment.md | |
| echo "</details>" >> diff_comment.md | |
| echo "" >> diff_comment.md | |
| done < changed_notebooks.txt | |
| echo "---" >> diff_comment.md | |
| echo "" >> diff_comment.md | |
| echo "*Generated by nbdime*" >> diff_comment.md | |
| - name: Post comment to PR | |
| if: steps.changed-notebooks.outputs.has_changes == 'true' | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| # Post the comment | |
| gh pr comment ${{ github.event.pull_request.number }} --body-file diff_comment.md |