File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Convert Jupyter Notebooks to Python Scripts
2+
3+ on :
4+ push :
5+
6+ jobs :
7+ convert_notebooks :
8+ runs-on : ubuntu-latest
9+
10+ steps :
11+ - name : Checkout repository
12+ uses : actions/checkout@v4
13+
14+ - name : Install Jupytext
15+ run : pip install jupytext black
16+
17+ - name : Convert notebooks to formatted Python scripts
18+ run : |
19+ for notebook in $(find . -name "*.ipynb"); do
20+ jupytext --to py:percent "$notebook"
21+ py_file="${notebook%.ipynb}.py"
22+ if [ -f "$py_file" ]; then
23+ black --line-length 120 "$py_file"
24+ fi
25+ done
26+
27+ - name : Get the last commit message
28+ id : get_commit_message
29+ run : echo "::set-output name=message::$(git log -1 --pretty=%B)"
30+
31+ - name : Commit changes
32+ run : |
33+ git config --global user.name "github-actions[bot]"
34+ git config --global user.email "github-actions[bot]@users.noreply.github.com"
35+ git add .
36+ git commit -m "nb2py: ${{ steps.get_commit_message.outputs.message }}"
37+ git push
38+ env :
39+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
You can’t perform that action at this time.
0 commit comments