forked from ClimateMatchAcademy/course-content
-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (66 loc) · 2.08 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
name: notebook-pr
on:
workflow_dispatch:
pull_request:
paths:
- '**/*.ipynb'
- .github/workflows/notebook-pr.yaml
- .github/actions/setup-ci.yaml
- 'environment.yml'
- '**/requirements.txt'
env:
NB_KERNEL: python
NMA_REPO: course-content
NMA_MAIN_BRANCH: main
jobs:
process-notebooks:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
persist-credentials: false
fetch-depth: 0
ref: ${{ github.head_ref }}
- name: Run Notebooks
uses: ./.github/actions/check-notebooks
with:
run_all: 'true'
exec_flag: '--check-only'
# exec_flag: '--execute'
# exercice-continue-on-error: 'true'
- name: Add PR comment
if: ${{ env.NBS != '' }}
uses: machine-learning-apps/[email protected]
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 "[email protected]"
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/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.head_ref }}