1010 paths :
1111 - ' **.Rmd'
1212 - assets/*
13+ - quizzes/*
1314
1415jobs :
1516
1819 runs-on : ubuntu-latest
1920 steps :
2021 - name : Checkout
21- uses : actions/checkout@v3
22+ uses : actions/checkout@v4
2223
2324 # Use the yaml-env-action action.
2425 - name : Load environment from YAML
2930 toggle_bookdown : " ${{ env.RENDER_BOOKDOWN }}"
3031 toggle_coursera : " ${{ env.RENDER_COURSERA }}"
3132 toggle_leanpub : " ${{ env.RENDER_LEANPUB }}"
33+ make_book_txt : " ${{ env.MAKE_BOOK_TXT }}"
3234 rendering_docker_image : " ${{ env.RENDERING_DOCKER_IMAGE }}"
3335 toggle_quiz_check : " ${{ env.CHECK_QUIZZES }}"
3436
@@ -42,16 +44,16 @@ jobs:
4244
4345 steps :
4446 - name : checkout
45- uses : actions/checkout@v3
47+ uses : actions/checkout@v4
4648 with :
4749 fetch-depth : 0
4850 token : ${{ secrets.GH_PAT }}
4951
5052 - name : Login as jhudsl-robot
5153 run : |
52- git config --system --add safe.directory " $GITHUB_WORKSPACE"
53- git config --local user.email "[email protected] " 54- git config --local user.name "jhudsl-robot"
54+ git config --global --add safe.directory $GITHUB_WORKSPACE
55+ git config --global user.email "[email protected] " 56+ git config --global user.name "jhudsl-robot"
5557
5658 # We want a fresh run of the renders each time
5759 - name : Delete old docs/*
@@ -78,10 +80,11 @@ jobs:
7880 GH_PAT : ${{ secrets.GH_PAT }}
7981 run : |
8082 git remote set-url origin https://${GH_PAT}@github.com/${GITHUB_REPOSITORY}
83+ git fetch origin
8184 git add --force docs/*
8285 git commit -m 'Render bookdown' || echo "No changes to commit"
8386 git pull --allow-unrelated-histories --strategy-option=ours
84- git push origin main || echo "No changes to push"
87+ git push -u origin main || echo "No changes to push"
8588
8689 render-tocless :
8790 name : Render TOC-less version for Leanpub or Coursera
@@ -93,15 +96,16 @@ jobs:
9396
9497 steps :
9598 - name : checkout
96- uses : actions/checkout@v3
99+ uses : actions/checkout@v4
97100 with :
98101 fetch-depth : 0
99102 token : ${{ secrets.GH_PAT }}
100103
101104 - name : Login as jhudsl-robot
102105 run : |
103- git config --local user.email "[email protected] " 104- git config --local user.name "jhudsl-robot"
106+ git config --global --add safe.directory $GITHUB_WORKSPACE
107+ git config --global user.email "[email protected] " 108+ git config --global user.name "jhudsl-robot"
105109
106110 # Rendered content for Leanpub and Coursera is very similar.
107111 # This job creates a shared scaffold for both.
@@ -115,10 +119,11 @@ jobs:
115119 GH_PAT : ${{ secrets.GH_PAT }}
116120 run : |
117121 git remote set-url origin https://${GH_PAT}@github.com/${GITHUB_REPOSITORY}
122+ git fetch origin
118123 git add --force docs/no_toc*
119124 git commit -m 'Render toc-less' || echo "No changes to commit"
120125 git pull --allow-unrelated-histories --strategy-option=ours
121- git push origin main || echo "No changes to push"
126+ git push -u origin main || echo "No changes to push"
122127
123128 render-leanpub :
124129 name : Finish Leanpub prep
@@ -130,15 +135,16 @@ jobs:
130135
131136 steps :
132137 - name : checkout
133- uses : actions/checkout@v3
138+ uses : actions/checkout@v4
134139 with :
135140 fetch-depth : 0
136141 token : ${{ secrets.GH_PAT }}
137142
138143 - name : Login as jhudsl-robot
139144 run : |
140- git config --local user.email "[email protected] " 141- git config --local user.name "jhudsl-robot"
145+ git config --global --add safe.directory $GITHUB_WORKSPACE
146+ git config --global user.email "[email protected] " 147+ git config --global user.name "jhudsl-robot"
142148
143149 # Create screenshots
144150 - name : Run the screenshot creation
@@ -153,16 +159,25 @@ jobs:
153159 --output_dir resources/chapt_screen_images)
154160
155161 # We want a fresh run of the renders each time
156- - name : Delete old manuscript/
157- run : rm -rf manuscript/
162+ - name : Delete manuscript/
163+ env :
164+ GH_PAT : ${{ secrets.GH_PAT }}
165+ run : |
166+ rm -rf manuscript/
167+ git remote set-url origin https://${GH_PAT}@github.com/${GITHUB_REPOSITORY}
168+ git fetch origin
169+ git add .
170+ git commit -m 'Delete manuscript folder' || echo "No changes to commit"
171+ git pull --allow-unrelated-histories --strategy-option=ours
172+ git push -u origin main || echo "No changes to push"
158173
159174 - name : Run ottrpal::bookdown_to_embed_leanpub
160175 if : needs.yaml-check.outputs.toggle_quiz_check == 'no'
161176 run : |
162177 Rscript -e "ottrpal::bookdown_to_embed_leanpub(
163178 render = FALSE, \
164179 chapt_img_key = 'resources/chapt_screen_images/chapter_urls.tsv', \
165- make_book_txt = TRUE , \
180+ make_book_txt = as.logical('${{needs.yaml-check.outputs.make_book_txt}}') , \
166181 quiz_dir = NULL)"
167182
168183 - name : Run ottrpal::bookdown_to_embed_leanpub
@@ -171,21 +186,20 @@ jobs:
171186 Rscript -e "ottrpal::bookdown_to_embed_leanpub(
172187 render = FALSE, \
173188 chapt_img_key = 'resources/chapt_screen_images/chapter_urls.tsv', \
174- make_book_txt = TRUE )"
189+ make_book_txt = as.logical('${{needs.yaml-check.outputs.make_book_txt}}') )"
175190
176191 # Commit the rendered Leanpub files
177192 - name : Commit rendered Leanpub files
178193 env :
179194 GH_PAT : ${{ secrets.GH_PAT }}
180195 run : |
181196 mkdir -p manuscript
182- git remote set-url origin https://${GH_PAT}@github.com/${GITHUB_REPOSITORY}
183197 git add --force manuscript/*
184198 git add --force resources/*
185199 git add --force docs/*
186200 git commit -m 'Render Leanpub' || echo "No changes to commit"
187201 git pull --allow-unrelated-histories --strategy-option=ours
188- git push origin main || echo "No changes to push"
202+ git push --force --set-upstream origin main || echo "No changes to push"
189203
190204 render-coursera :
191205 name : Finish Coursera prep
@@ -197,15 +211,16 @@ jobs:
197211
198212 steps :
199213 - name : checkout
200- uses : actions/checkout@v3
214+ uses : actions/checkout@v4
201215 with :
202216 fetch-depth : 0
203217 token : ${{ secrets.GH_PAT }}
204218
205219 - name : Login as jhudsl-robot
206220 run : |
207- git config --local user.email "[email protected] " 208- git config --local user.name "jhudsl-robot"
221+ git config --global --add safe.directory $GITHUB_WORKSPACE
222+ git config --global user.email "[email protected] " 223+ git config --global user.name "jhudsl-robot"
209224
210225 # Run Coursera version
211226 - name : Convert Leanpub quizzes to Coursera
@@ -219,9 +234,10 @@ jobs:
219234 GH_PAT : ${{ secrets.GH_PAT }}
220235 run : |
221236 git remote set-url origin https://${GH_PAT}@github.com/${GITHUB_REPOSITORY}
237+ git fetch origin
222238 git add --force manuscript/*
223239 git add --force resources/*
224240 git add --force docs/*
225241 git commit -m 'Render Coursera quizzes' || echo "No changes to commit"
226242 git pull --allow-unrelated-histories --strategy-option=ours
227- git push origin main || echo "No changes to push"
243+ git push -u origin main || echo "No changes to push"
0 commit comments