Skip to content

Curriculum specialist's fixes and changes for release-v1.0.3 #312

Curriculum specialist's fixes and changes for release-v1.0.3

Curriculum specialist's fixes and changes for release-v1.0.3 #312

Workflow file for this run

name: notebook-pr
on:
workflow_dispatch:
pull_request:
branches:
- main
paths:
- '**/*.ipynb'
- .github/workflows/notebook-pr.yaml
- .github/actions/setup-ci.yaml
- 'environment.yml'
- '**/requirements.txt'
env:
NB_KERNEL: python
NMA_REPO: climate-course-content
NMA_MAIN_BRANCH: main
ORG: neuromatch
jobs:
process-notebooks:
# runs-on: ubuntu-latest
# runs-on: ubuntu-20.04
runs-on: climate_runner
steps:
- name: Free up disk space
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: false
# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
- name: Checkout
uses: actions/checkout@v3
with:
persist-credentials: false
fetch-depth: 0
ref: ${{ github.head_ref }}
- name: Update Ubuntu
run: |
sudo apt update
- name: Run Notebooks
uses: ./.github/actions/check-notebooks
with:
run_all: 'false'
# exec_flag: '--check-only'
exec_flag: '--execute'
# exercise-continue-on-error: true
cdsapi_uid: ${{ secrets.CDSAPI_UID }}
cdsapi_key: ${{ secrets.CDSAPI_KEY }}
# - name: Add PR comment
# if: ${{ env.NBS != '' }}
# uses: machine-learning-apps/pr-comment@master
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# path: comment.txt
- name: Update READMEs
if: ${{ env.NBS != '' }}
run: python ci/generate_tutorial_readmes.py
shell: bash -l {0}
- name: Remove unreferenced derivatives
if: ${{ env.NBS != '' }}
run: |
python ci/find_unreferenced_content.py > to_remove.txt
if [ -s to_remove.txt ]; then git rm --pathspec-from-file=to_remove.txt; fi
shell: bash -l {0}
- name: Commit post-processed files
if: ${{ env.NBS != '' }}
# continue-on-error: true
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add '**/*.ipynb'
git add '**/static/*.png'
git add '**/solutions/*.py'
git add '**/README.md'
git diff-index --quiet HEAD || git commit -m "Process tutorial notebooks"
shell: bash -l {0}
- name: Push post-processed files
if: ${{ env.NBS != '' }}
uses: ad-m/github-push-action@v0.6.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.head_ref }}