Run Jupyter Notebook #54
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: Run Jupyter Notebook | |
on: | |
schedule: | |
- cron: '0 16 * * *' # Runs every day at 4 PM UTC | |
workflow_dispatch: # Allows manual triggering of the workflow | |
jobs: | |
execute-notebook: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' # Specify the Python version you need | |
- name: Install dependencies | |
run: | | |
pip install -r requirements.txt | |
pip install nbconvert jupyter ipykernel | |
- name: Set up Jupyter kernel | |
run: | | |
python -m ipykernel install --user --name python3 --display-name "Python 3" | |
- name: Execute notebook | |
run: | | |
mkdir -p graphics # Create directory for images if it doesn't exist | |
jupyter nbconvert --to notebook --execute barcelonadori_map.ipynb --output barcelonadori_map.ipynb --inplace | |
- name: Configure Git | |
run: | | |
git config --local user.name "GitHub Actions" | |
git config --local user.email "[email protected]" | |
- name: Commit and push changes | |
run: | | |
git add barcelonadori_map.ipynb graphics/* # Include saved images | |
git commit -m "Update barcelonadori_map.ipynb and graphics with latest data" | |
git push | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |