Skip to content

Instantly share code, notes, and snippets.

@ArthurFDLR
Created May 9, 2024 05:04
Show Gist options
  • Save ArthurFDLR/6aa3f00821014b552cca6a541ff10d4c to your computer and use it in GitHub Desktop.
Save ArthurFDLR/6aa3f00821014b552cca6a541ff10d4c to your computer and use it in GitHub Desktop.
Github Action to update the README.md with the content of a README.ipynb
name: Convert README.ipynb to README.md
on:
push:
branches:
- main
paths:
- '**/README.ipynb'
jobs:
convert-notebook:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Check out repository
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install nbconvert
run: |
python -m pip install --upgrade pip
pip install nbconvert
- name: Convert README.ipynb to README.md
run: jupyter-nbconvert --to markdown README.ipynb
- name: Commit and push if changes
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add README.md
git commit -m "Update README.md" || exit 0 # Do nothing if no changes
git push
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment