1- # Candace Savonen Aug 2022
1+ # Candace Savonen 2021
2+ # Updated Jan 2023
23
34name : Pull Request
45
1314 runs-on : ubuntu-latest
1415 steps :
1516 - name : Checkout
16- uses : actions/checkout@v2
17+ uses : actions/checkout@v3
1718 with :
1819 fetch-depth : 0
1920
2324 with :
2425 files : config_automation.yml # Pass a space-separated list of configuration files. Rightmost files take precedence.
2526
26- - name : Verify Dockerfiles changed?
27- uses : tj-actions/verify-changed-files@v8.8
28- id : verify-changed-files
29- with :
30- files : |
31- docker/Dockerfile
32- docker/github_package_list.tsv
33-
3427 # Delete the branch if this has been run before
3528 - name : Delete branch locally and remotely
3629 run : git push origin --delete preview-${{ github.event.pull_request.number }} || echo "No branch to delete"
5346 toggle_url_check : " ${{ env.URL_CHECKER }}"
5447 toggle_quiz_check : " ${{ env.CHECK_QUIZZES }}"
5548 toggle_render_preview : " ${{ env.RENDER_PREVIEW }}"
56- toggle_docker_build : " ${{ env.DOCKER_BUILD }}"
5749 rendering_docker_image : " ${{ env.RENDERING_DOCKER_IMAGE }}"
58- dockerfiles_changed : steps.verify-changed-files.outputs.files_changed
5950
6051# ######################### Make the error reports ##############################
6152 spell-check :
9990
10091 steps :
10192 - name : Checkout files
102- uses : actions/checkout@v2
93+ uses : actions/checkout@v3
10394 with :
10495 fetch-depth : 0
10596
10899
109100 - name : Commit styled files
110101 run : |
102+ git config --system --add safe.directory "$GITHUB_WORKSPACE"
111103 git add \*.Rmd
112104 git commit -m 'Style Rmds' || echo "No changes to commit"
113105 git push origin || echo "No changes to commit"
@@ -124,13 +116,14 @@ jobs:
124116
125117 steps :
126118 - name : Checkout files
127- uses : actions/checkout@v2
119+ uses : actions/checkout@v3
128120 with :
129121 fetch-depth : 0
130122
131123 # Set up git checkout
132124 - name : Set up git checkout
133125 run : |
126+ git config --system --add safe.directory "$GITHUB_WORKSPACE"
134127 git config --local user.email "itcrtrainingnetwork@gmail.com"
135128 git config --local user.name "jhudsl-robot"
136129
@@ -167,15 +160,15 @@ jobs:
167160 run : |
168161 branch_name='preview-${{ github.event.pull_request.number }}'
169162 git diff origin/main -- docs >/dev/null && changes=true || changes=false
170- echo ::set-output name= changes:: $changes
163+ echo " changes= $changes" >> $GITHUB_OUTPUT
171164 git add . --force
172165 git commit -m 'Render preview' || echo "No changes to commit"
173166 git pull --set-upstream origin $branch_name --allow-unrelated-histories --strategy-option=ours
174167 git push --force || echo "No changes to commit"
175168 shell : bash
176169
177170 - name : Find Comment
178- uses : peter-evans/find-comment@v1
171+ uses : peter-evans/find-comment@v2
179172 id : fc
180173 with :
181174 issue-number : ${{ github.event.pull_request.number }}
@@ -189,16 +182,16 @@ jobs:
189182 bookdown_link=$(echo "https://htmlpreview.github.io/?https://raw.githubusercontent.com/$GITHUB_REPOSITORY/preview-${{ github.event.pull_request.number }}/docs/index.html")
190183 tocless_link=$(echo "https://htmlpreview.github.io/?https://raw.githubusercontent.com/$GITHUB_REPOSITORY/preview-${{ github.event.pull_request.number }}/docs/no_toc/index.html")
191184 docx_link=$(echo "https://github.com/$GITHUB_REPOSITORY/raw/preview-${{ github.event.pull_request.number }}/docs/$course_name.docx")
192- echo ::set-output name= bookdown_link:: $bookdown_link
193- echo ::set-output name= tocless_link:: $tocless_link
194- echo ::set-output name= docx_link:: $docx_link
195- echo ::set-output name= time:: $(date +'%Y-%m-%d')
196- echo ::set-output name= commit_id:: $GITHUB_SHA
185+ echo " bookdown_link= $bookdown_link" >> $GITHUB_OUTPUT
186+ echo " tocless_link= $tocless_link" >> $GITHUB_OUTPUT
187+ echo " docx_link= $docx_link" >> $GITHUB_OUTPUT
188+ echo " time= $(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
189+ echo " commit_id= $GITHUB_SHA" >> $GITHUB_OUTPUT
197190 echo ${{steps.commit.outputs.changes}}
198191
199192 - name : Create or update comment
200193 if : steps.commit.outputs.changes == 'true'
201- uses : peter-evans/create-or-update-comment@v1
194+ uses : peter-evans/create-or-update-comment@v2
202195 with :
203196 comment-id : ${{ steps.fc.outputs.comment-id }}
204197 issue-number : ${{ github.event.pull_request.number }}
@@ -213,7 +206,7 @@ jobs:
213206
214207 - name : Comment if no changes
215208 if : steps.commit.outputs.changes == 'false'
216- uses : peter-evans/create-or-update-comment@v1
209+ uses : peter-evans/create-or-update-comment@v2
217210 with :
218211 comment-id : ${{ steps.fc.outputs.comment-id }}
219212 issue-number : ${{ github.event.pull_request.number }}
@@ -222,56 +215,3 @@ jobs:
222215
223216 _Updated at ${{ steps.build-components.outputs.time }} with changes from ${{ steps.build-components.outputs.commit_id }}_
224217 edit-mode : replace
225-
226- # ############################# Build Docker ####################################
227-
228- build-docker :
229- name : Build Docker image
230- needs : yaml-check
231- runs-on : ubuntu-latest
232- if : ${{needs.yaml-check.outputs.toggle_docker_build == 'yes' && needs.yaml-check.outputs.dockerfiles_changed == 'true' && github.head_ref != 'repo-sync/OTTR_Template/default'}}
233-
234- steps :
235- - name : checkout repo
236- uses : actions/checkout@v2
237-
238- - name : Verify Dockerfiles changed?
239- uses : tj-actions/verify-changed-files@v8.8
240- id : verify-changed-files
241- with :
242- files : |
243- docker/Dockerfile
244- docker/github_package_list.tsv
245-
246- - name : Login as jhudsl-robot
247- run : |
248- git config --local user.email "itcrtrainingnetwork@gmail.com"
249- git config --local user.name "jhudsl-robot"
250-
251- # Set up Docker build
252- - name : Set up Docker Buildx
253- uses : docker/setup-buildx-action@v1
254-
255- # Setup layer cache
256- - name : Cache Docker layers
257- uses : actions/cache@v2
258- with :
259- path : /tmp/.buildx-cache
260- key : ${{ runner.os }}-buildx-${{ github.sha }}
261- restore-keys : |
262- ${{ runner.os }}-buildx-
263-
264- - name : Set up Docker Build
265- uses : docker/setup-buildx-action@v1
266-
267- - name : Get token
268- run : echo ${{ secrets.GH_PAT }} > docker/git_token.txt
269-
270- - name : Build Docker image
271- uses : docker/build-push-action@v2
272- with :
273- push : false
274- load : true
275- context : docker
276- file : docker/Dockerfile
277- tags : jhudsl/base_ottr
0 commit comments