Skip to content

Commit 0cdaee2

Browse files
authored
Refactor notebook rendering workflow for efficiency
1 parent 7b7fcda commit 0cdaee2

1 file changed

Lines changed: 12 additions & 22 deletions

File tree

.github/workflows/render-notebooks.yml

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -42,30 +42,20 @@ jobs:
4242
git config --global user.email "github-actions[bot]@users.noreply.github.com"
4343
git config --global user.name "github-actions[bot]"
4444
45-
- name: Check for changes
46-
id: git-check
47-
run: |
48-
# More reliable way to check for changes in notebooks
49-
git update-index --refresh
50-
if git diff-index --quiet HEAD -- "*.ipynb"; then
51-
echo "No changes detected in notebooks"
52-
echo "has_changes=false" >> $GITHUB_OUTPUT
53-
else
54-
echo "Changes detected in notebooks"
55-
echo "has_changes=true" >> $GITHUB_OUTPUT
56-
fi
57-
58-
- name: Show modified files
59-
if: steps.git-check.outputs.has_changes == 'true'
60-
run: git status
61-
62-
- name: Commit and push changes to current branch
63-
if: steps.git-check.outputs.has_changes == 'true'
45+
- name: Commit and push changes
6446
run: |
6547
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
6648
echo "Current branch: $CURRENT_BRANCH"
6749
68-
# Add, commit, and push changes
50+
# Stage all notebook files
6951
git add "**/*.ipynb"
70-
git commit -m "Render notebooks for GitHub compatibility"
71-
git push https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git HEAD:${CURRENT_BRANCH}
52+
53+
# Check if there are changes to commit
54+
if git diff --staged --quiet; then
55+
echo "No changes detected in notebooks"
56+
else
57+
echo "Changes detected in notebooks"
58+
git commit -m "Fix notebooks for GitHub compatibility"
59+
git push https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git HEAD:${CURRENT_BRANCH}
60+
echo "Successfully pushed changes"
61+
fi

0 commit comments

Comments
 (0)