Skip to content

Commit c5922f2

Browse files
committed
fix bugs in github actions
1 parent e1816c3 commit c5922f2

1 file changed

Lines changed: 61 additions & 61 deletions

File tree

.github/workflows/execute_notebooks.yml

Lines changed: 61 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -21,72 +21,72 @@ jobs:
2121
runs-on: ubuntu-latest
2222

2323
steps:
24-
- name: Checkout repository
25-
uses: actions/checkout@v4
26-
with:
27-
token: ${{ secrets.GITHUB_TOKEN }}
28-
fetch-depth: 0
24+
- name: Checkout repository
25+
uses: actions/checkout@v4
26+
with:
27+
token: ${{ secrets.GITHUB_TOKEN }}
28+
fetch-depth: 0
2929

30-
- name: Set up Python
31-
uses: actions/setup-python@v4
32-
with:
33-
python-version: '3.12'
34-
cache: 'pip'
30+
- name: Set up Python
31+
uses: actions/setup-python@v4
32+
with:
33+
python-version: '3.12'
34+
cache: 'pip'
3535

36-
- name: Install dependencies
37-
run: |
38-
# Install system dependencies
39-
sudo apt update
40-
sudo apt install pandoc
41-
42-
# Install Python dependencies
43-
python -m pip install --upgrade pip
44-
pip install jupyter nbconvert nbformat
45-
pip install -r requirements.txt
46-
pip install ipykernel rdkit cairosvg pymzml
47-
pip install .
36+
- name: Install dependencies
37+
run: |
38+
# Install system dependencies
39+
sudo apt update
40+
sudo apt install pandoc
41+
42+
# Install Python dependencies
43+
python -m pip install --upgrade pip
44+
pip install jupyter nbconvert nbformat
45+
pip install -r requirements.txt
46+
pip install ipykernel rdkit cairosvg pymzml
47+
pip install .
4848
49-
- name: Configure git
50-
run: |
51-
git config --local user.email "action@github.com"
52-
git config --local user.name "GitHub Action"
49+
- name: Configure git
50+
run: |
51+
git config --local user.email "action@github.com"
52+
git config --local user.name "GitHub Action"
5353
54-
- name: Find and execute notebooks
55-
run: |
56-
# Find all notebooks that need to execute (adjust paths as needed)
57-
find docs/Data Formatting/*ipynb -name "*.ipynb" > notebooks_to_execute.txt
58-
docs/Getting\ Started.ipynb > notebooks_to_execute.txt
54+
- name: Find and execute notebooks
55+
run: |
56+
# Find all notebooks that need to execute (adjust paths as needed)
57+
find "docs/Data Formatting/" -name "*.ipynb" > notebooks_to_execute.txt
58+
"docs/Getting Started.ipynb" >> notebooks_to_execute.txt
5959
60-
echo "Found notebooks:"
61-
cat notebooks_to_execute.txt
62-
63-
# Execute each notebook
64-
while IFS= read -r notebook; do
65-
echo "Executing: $notebook"
66-
# Clear outputs first (optional)
67-
jupyter nbconvert --clear-output --inplace "$notebook"
68-
# Execute notebook
69-
jupyter nbconvert --execute --to notebook --inplace "$notebook" \
70-
--ExecutePreprocessor.timeout=300 \
71-
--ExecutePreprocessor.kernel_name=python3
60+
echo "Found notebooks:"
61+
cat notebooks_to_execute.txt
7262
73-
# Check if execution was successful
74-
if [ $? -eq 0 ]; then
75-
echo "✓ Successfully executed: $notebook"
63+
# Execute each notebook
64+
while IFS= read -r notebook; do
65+
echo "Executing: $notebook"
66+
# Clear outputs first (optional)
67+
jupyter nbconvert --clear-output --inplace "$notebook"
68+
# Execute notebook
69+
jupyter nbconvert --execute --to notebook --inplace "$notebook" \
70+
--ExecutePreprocessor.timeout=300 \
71+
--ExecutePreprocessor.kernel_name=python3
72+
73+
# Check if execution was successful
74+
if [ $? -eq 0 ]; then
75+
echo "✓ Successfully executed: $notebook"
76+
else
77+
echo "✗ Failed to execute: $notebook"
78+
exit 1
79+
fi
80+
done < notebooks_to_execute.txt
81+
- name: Push changes
82+
if: steps.verify-changed-files.outputs.changed == 'true' && github.event_name != 'pull_request'
83+
run: |
84+
git push origin ${{ github.ref_name }}
85+
86+
- name: Summary
87+
run: |
88+
if [ "${{ steps.verify-changed-files.outputs.changed }}" == "true" ]; then
89+
echo "✅ Notebooks executed successfully and changes committed"
7690
else
77-
echo "✗ Failed to execute: $notebook"
78-
exit 1
91+
echo "✅ Notebooks executed successfully, no changes to commit"
7992
fi
80-
done < notebooks_to_execute.txt
81-
- name: Push changes
82-
if: steps.verify-changed-files.outputs.changed == 'true' && github.event_name != 'pull_request'
83-
run: |
84-
git push origin ${{ github.ref_name }}
85-
86-
- name: Summary
87-
run: |
88-
if [ "${{ steps.verify-changed-files.outputs.changed }}" == "true" ]; then
89-
echo "✅ Notebooks executed successfully and changes committed"
90-
else
91-
echo "✅ Notebooks executed successfully, no changes to commit"
92-
fi

0 commit comments

Comments
 (0)