Copy Example notebooks from main PGM repo to PGM-workshop #1
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: Copy Example notebooks from main PGM repo to PGM-workshop | |
on: | |
schedule: | |
- cron: "25 13 * * *" | |
jobs: | |
copy-files: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout PGM Repository | |
uses: actions/checkout@v2 | |
with: | |
repository: PowerGridModel/power-grid-model | |
ref: main | |
- name: Copy Files | |
run: | | |
cp -r power-grid-model/docs/examples/* $GITHUB_WORKSPACE | |
- name: Checkout PGM workshop repository | |
uses: actions/checkout@v2 | |
with: | |
repository: PowerGridModel/power-grid-model-workshop | |
ref: feature/example-workflow | |
token: ${{ secrets.PAT_TOKEN }} | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.10 # because we mention 3.10 in the build guide | |
- name: Install Python dependencies | |
run: | | |
python -m venv venv | |
source venv/bin/activate | |
pip install -r requirements.txt | |
- name: Run the notebooks | |
run: | | |
source venv/bin/activate | |
jupyter nbconvert --to notebook --execute $GITHUB_WORKSPACE.ipynb | |
- name: Commit and Push Changes to PGM workshop repository | |
run: | | |
git config user.name 'GitHub Action' | |
git config user.email '[email protected]' | |
git add . | |
if git diff-index --quiet HEAD; then | |
echo "No changes detected." | |
else | |
git commit -m "Update PGM examples" | |
git push | |