Test changes #7
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
| # .github/workflows/propagate-config.yml | ||
| # This workflow keeps repos in sync | ||
| name: Remove Notebook Outputs | ||
| permissions: | ||
| contents: write | ||
| on: | ||
| push: | ||
| push: | ||
| branches: | ||
| - '' | ||
| pull_request: | ||
| branches: | ||
| - '' | ||
| jobs: | ||
| remove-notebook-outputs: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout source repo | ||
| uses: actions/checkout@v4 | ||
| - name: Set up Git | ||
| run: | | ||
| git config --global user.name "Clear Notebook Outputs Action" | ||
| git config --global user.email "[email protected]" | ||
| - name: Install prerequisites | ||
| run: | | ||
| sudo apt-get update -y | ||
| sudo apt-get install python3.8 -y | ||
| echo ✅ Install Jupyter notebook | ||
| echo ✅ ------------------------ | ||
| # Install Jupyter notebook | ||
| sudo apt-get install jupyter -y | ||
| - name: Clear Jupyter notebook run outputs | ||
| run: | | ||
| # Get all notebook files | ||
| files=$(git ls-files '*.ipynb') | ||
| [ -z "$files" ] && exit 0 | ||
| for f in $files; do | ||
| echo $f | ||
| # Clear outputs + execution_count in place | ||
| jupyter nbconvert \ | ||
| --ClearOutputPreprocessor.enabled=True \ | ||
| --inplace "$f" | ||
| # Re-stage cleaned file | ||
| git add "$f" | ||
| done | ||
| git commit -m "Clear notebook outputs" --no-verify | ||
| git push origin HEAD:${{ github.ref_name }} | ||