change README params #7
This file contains 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
name: Generate README | |
on: | |
push: | |
branches: [main] | |
jobs: | |
generate_readme: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of the personal access token. | |
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install jupyter | |
pip install nbconvert | |
pip install black_nbconvert | |
pip install markupsafe==2.0.1 | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
git config --local user.email "action@github.com" | |
git config --local user.name "GitHub Action" | |
- name: Clear and format Jupyter Notebook output | |
run: | | |
jupyter nbconvert --clear-output --inplace *.ipynb | |
black_nbconvert . | |
- name: Commit cleared and formatted jupyter notebook | |
run: | | |
git add *.ipynb | |
git commit -m "format and clear jupyter notebook output" || echo "No changes to commit" | |
- name: Convert README ipynb to md | |
run: | | |
rm -rf README_files | |
jupyter nbconvert --to markdown --execute README.ipynb | |
- name: Commit README | |
run: | | |
git add README.md README_files | |
git commit -m "update readme files" || echo "No changes to commit" | |
- name: Push changes | |
uses: ad-m/github-push-action@v0.6.0 | |
with: | |
github_token: ${{ github.token }} | |
branch: main | |
generate_readme_toc: | |
needs: generate_readme | |
name: Generate TOC | |
runs-on: ubuntu-latest | |
steps: | |
- uses: technote-space/toc-generator@v4 |