Merge branch 'feature/sync-examples-workflow' of https://github.com/P… #78
Workflow file for this run
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: Sync example notebooks from main PGM repo to PGM-workshop | |
on: | |
push: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 2 * * *" # Based on UTC time | |
jobs: | |
sync-files: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout PGM workshop repository | |
uses: actions/checkout@v4 | |
with: | |
path: power-grid-model-workshop | |
- name: Checkout PGM Repository examples | |
uses: actions/checkout@v4 | |
with: | |
repository: PowerGridModel/power-grid-model | |
ref: main | |
path: power-grid-model | |
sparse-checkout: docs/examples | |
sparse-checkout-cone-mode: false | |
- name: Move pgm examples to pgm workshop repository | |
run: | | |
ls power-grid-model-workshop | |
rm -rf power-grid-model-workshop/examples | |
mv power-grid-model/docs/examples power-grid-model-workshop | |
ls power-grid-model-workshop | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.11 | |
- name: Install Python dependencies | |
run: pip install -r requirements.txt | |
working-directory: power-grid-model-workshop | |
- name: Use REs to replace links | |
run: sed -i 's|\.\./\(.*\)\.md|https://power-grid-model.readthedocs.io/en/stable/\1.html|g' *.ipynb | |
working-directory: power-grid-model-workshop/examples | |
- name: Run the notebooks | |
run: | | |
find examples -name "*.ipynb"| while IFS= read -r notebook; do | |
jupyter nbconvert --execute --allow-errors --inplace "$notebook" | |
done | |
working-directory: power-grid-model-workshop | |
- name: Commit and Push Changes to PGM workshop repository | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
commit_message: Update the examples | |
repository: power-grid-model-workshop | |
commit_options: '--signoff' | |
commit_user_name: GitHub Actions Bot | |
commit_user_email: [email protected] | |
commit_author: GitHub Actions Bot <[email protected]> |