-
Notifications
You must be signed in to change notification settings - Fork 6
56 lines (45 loc) · 1.37 KB
/
sync-examples.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name: Sync example notebooks from main PGM repo to PGM-workshop
on:
push:
branches:
- sync-examples-workflow
workflow_dispatch:
schedule:
- cron: "32 14 * * *" # Based on UTC time
jobs:
sync-files:
runs-on: ubuntu-latest
steps:
- name: Checkout PGM workshop repository
uses: actions/checkout@v4
- name: Checkout PGM Repository
uses: actions/checkout@v4
with:
repository: PowerGridModel/power-grid-model
ref: main
- name: Copy Files
run: |
cp -r docs/examples $GITHUB_WORKSPACE
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.11
- 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
- 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