File tree Expand file tree Collapse file tree 1 file changed +58
-0
lines changed Expand file tree Collapse file tree 1 file changed +58
-0
lines changed Original file line number Diff line number Diff line change 1+ # .github/workflows/propagate-config.yml
2+ # This workflow keeps repos in sync
3+ name : Remove Notebook Outputs
4+ permissions :
5+ contents : write
6+
7+ on :
8+ push :
9+ push :
10+ branches :
11+ - ' **'
12+ pull_request :
13+ branches :
14+ - ' **'
15+
16+
17+ jobs :
18+ remove-notebook-outputs :
19+ runs-on : ubuntu-latest
20+ steps :
21+ - name : Checkout source repo
22+ uses : actions/checkout@v4
23+
24+ - name : Set up Git
25+ run : |
26+ git config --global user.name "Clear Notebook Outputs Action"
27+ git config --global user.email "[email protected] " 28+
29+ - name : Install prerequisites
30+ run : |
31+ sudo apt-get update -y
32+
33+ sudo apt-get install python3.8 -y
34+
35+ echo ✅ Install Jupyter notebook
36+ echo ✅ ------------------------
37+ # Install Jupyter notebook
38+ sudo apt-get install jupyter -y
39+
40+ - name : Clear Jupyter notebook run outputs
41+ run : |
42+ # Get all notebook files
43+ files=$(git ls-files '*.ipynb')
44+ [ -z "$files" ] && exit 0
45+
46+ for f in $files; do
47+ echo $f
48+ # Clear outputs + execution_count in place
49+ jupyter nbconvert \
50+ --ClearOutputPreprocessor.enabled=True \
51+ --inplace "$f"
52+
53+ # Re-stage cleaned file
54+ git add "$f"
55+ done
56+
57+ git commit -m "Clear notebook outputs" --no-verify
58+ git push origin HEAD:${{ github.ref_name }}
You can’t perform that action at this time.
0 commit comments