Skip to content

New use case forms (#240) #25

New use case forms (#240)

New use case forms (#240) #25

Workflow file for this run

name: Python Code Check in docs and README
on:
push:
branches:
- main
jobs:
check-code:
runs-on: ubuntu-latest
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.10'
- name: Extract Python code from README.md
run: |
sed -n '/```python/,/```/p' README.md | sed '/```*/d' > check-code.py
- name: Install dependencies
run: |
pip install lavague
- name: Check code consistency with docs/index.md
run: |
if ! diff -wu <(sed -n '/```python/,/```/p' README.md | sed '/```*/d') <(sed -n '/```python/,/```/p' docs/index.md | sed '/```*/d'); then
echo "The Python code blocks in README.md and docs/index.md do not match."
exit 1
fi
- name: Run the Python script
run: |
python check-code.py
execute-notebook:
runs-on: ubuntu-latest
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.10'
- name: Install Python dependencies and nbconvert
run: pip install notebook nbconvert lavague
- name: Execute the notebook
run: jupyter nbconvert --to notebook --execute --inplace --output executed_notebook.ipynb docs/docs/get-started/quick-tour-notebook/quick-tour.ipynb
notify:
runs-on: ubuntu-latest
needs: [ check-code]
if: ${{ failure() || needs.check-code.outcome == 'failure' || needs.execute-notebook.outcome == 'failure'}}
steps:
- name: Send failure notification via Discord
uses: Ilshidur/action-discord@0c4b27844ba47cb1c7bee539c8eead5284ce9fa9
with:
args: "The code in the README fails or differs from the code on docs home - please fix!"
env:
DISCORD_WEBHOOK: ${{ secrets.DOCS_DISCORD_WEBHOOK }}