Skip to content

Remove all empty (0 KB) Jupyter notebooks from workspace #3

Remove all empty (0 KB) Jupyter notebooks from workspace

Remove all empty (0 KB) Jupyter notebooks from workspace #3

name: Convert Jupyter Notebook to HTML and Deploy to GitHub Pages
on:
push:
paths:
- '**.ipynb'
jobs:
convert:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
lfs: true
- name: Install Git LFS
run: git lfs install
- name: Pull LFS files (redundant but safe)
run: git lfs pull
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
pip install --upgrade pip
pip install notebook==7.0.6 pandas matplotlib numpy plotly scikit-learn
- name: Validate notebooks
run: |
set -e
for notebook in $(find . -name "*.ipynb"); do
python -c "import json; json.load(open('$notebook'))" || \
echo "Invalid JSON in $notebook" && exit 1
done
- name: Clean output directory
run: rm -rf converted_html && mkdir -p converted_html
- name: Convert all notebooks to HTML
run: |
set -e
for notebook in $(find . -name "*.ipynb"); do
jupyter nbconvert --to html "$notebook" --output-dir=converted_html
done
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./converted_html
force_orphan: true