forked from neuromatch/climate-course-content
-
Notifications
You must be signed in to change notification settings - Fork 0
104 lines (90 loc) · 2.89 KB
/
notebook-pr.yaml
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
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 }}