1414 runs-on : ubuntu-latest
1515 steps :
1616 - name : Checkout
17- uses : actions/checkout@v3
17+ uses : actions/checkout@v4
1818 with :
1919 fetch-depth : 0
20+ token : ${{ secrets.GH_PAT }}
2021
2122 # Use the yaml-env-action action.
2223 - name : Load environment from YAML
@@ -31,16 +32,17 @@ jobs:
3132 # Make the branch fresh
3233 - name : Make the branch fresh
3334 run : |
34- git config --global --add safe.directory ${ GITHUB_WORKSPACE}
35- git config --global user.email "itcrtrainingnetwork@gmail.com"
36- git config --global user.name "jhudsl-robot"
35+ git config --global --add safe.directory $GITHUB_WORKSPACE
36+ git config --global user.name 'github-actions[bot]'
37+ git config --global user.email 'github-actions[bot]@users.noreply.github.com'
3738
3839 branch_name='preview-${{ github.event.pull_request.number }}'
3940 echo branch doesnt exist
4041 git checkout -b $branch_name || echo branch exists
41- git push --set-upstream origin $branch_name
42+ git push --set-upstream origin $branch_name || echo echo branch exists remotely
4243 shell : bash
4344
45+
4446 outputs :
4547 toggle_spell_check : " ${{ env.SPELL_CHECK }}"
4648 toggle_style_code : " ${{ env.STYLE_CODE }}"
5961 check_type : spelling
6062 error_min : 3
6163 gh_pat : secrets.GH_PAT
64+ branch_name : ${GITHUB_HEAD_REF}
6265
6366 url-check :
6467 name : Check URLs
6972 check_type : urls
7073 error_min : 0
7174 gh_pat : secrets.GH_PAT
75+ branch_name : ${GITHUB_HEAD_REF}
7276
7377 quiz-check :
7478 name : Check quiz formatting
7983 check_type : quiz_format
8084 error_min : 0
8185 gh_pat : secrets.GH_PAT
86+ branch_name : ${GITHUB_HEAD_REF}
8287
8388# ############################ Style the code ###################################
8489 style-code :
9196
9297 steps :
9398 - name : Checkout files
94- uses : actions/checkout@v3
99+ uses : actions/checkout@v4
95100 with :
96101 fetch-depth : 0
97102
@@ -117,16 +122,16 @@ jobs:
117122
118123 steps :
119124 - name : Checkout files
120- uses : actions/checkout@v3
125+ uses : actions/checkout@v4
121126 with :
122127 fetch-depth : 0
123128
124129 # Set up git checkout
125130 - name : Set up git checkout
126131 run : |
127- git config --system --add safe.directory " $GITHUB_WORKSPACE"
128- git config --local user.email "itcrtrainingnetwork@gmail.com"
129- git config --local user.name "jhudsl-robot"
132+ git config --global --add safe.directory $GITHUB_WORKSPACE
133+ git config --global user.name 'github-actions[bot]'
134+ git config --global user.email 'github-actions[bot]@users.noreply.github.com'
130135
131136 branch_name='preview-${{ github.event.pull_request.number }}'
132137 git fetch --all
@@ -155,6 +160,9 @@ jobs:
155160 echo Toc-less status ${{steps.tocless.outcome}}
156161 exit 1
157162
163+ - name : Website preview for download
164+ run : zip website-preview.zip docs/* -r
165+
158166 # Commit the rendered bookdown files
159167 - name : Commit rendered bookdown files to preview branch
160168 id : commit
@@ -164,7 +172,7 @@ jobs:
164172 echo "changes=$changes" >> $GITHUB_OUTPUT
165173 git add . --force
166174 git commit -m 'Render preview' || echo "No changes to commit"
167- git pull --set-upstream origin $branch_name --allow-unrelated-histories --strategy-option=ours
175+ git pull --rebase -- set-upstream origin $branch_name --allow-unrelated-histories --strategy-option=ours
168176 git push --force || echo "No changes to commit"
169177 shell : bash
170178
@@ -183,6 +191,8 @@ jobs:
183191 bookdown_link=$(echo "https://htmlpreview.github.io/?https://raw.githubusercontent.com/$GITHUB_REPOSITORY/preview-${{ github.event.pull_request.number }}/docs/index.html")
184192 tocless_link=$(echo "https://htmlpreview.github.io/?https://raw.githubusercontent.com/$GITHUB_REPOSITORY/preview-${{ github.event.pull_request.number }}/docs/no_toc/index.html")
185193 docx_link=$(echo "https://github.com/$GITHUB_REPOSITORY/raw/preview-${{ github.event.pull_request.number }}/docs/$course_name.docx")
194+ zip_link=$(echo "https://github.com/$GITHUB_REPOSITORY/raw/preview-${{ github.event.pull_request.number }}/website-preview.zip")
195+ echo "zip_link=$zip_link" >> $GITHUB_OUTPUT
186196 echo "bookdown_link=$bookdown_link" >> $GITHUB_OUTPUT
187197 echo "tocless_link=$tocless_link" >> $GITHUB_OUTPUT
188198 echo "docx_link=$docx_link" >> $GITHUB_OUTPUT
@@ -198,11 +208,13 @@ jobs:
198208 issue-number : ${{ github.event.pull_request.number }}
199209 body : |
200210 Re-rendered previews from the latest commit:
201- - See [preview of Bookdown here](${{ steps.build-components.outputs.bookdown_link }})
202- - See [preview of Coursera/Leanpub version here](${{ steps.build-components.outputs.tocless_link }})
203- - Download the [preview of .docx file](${{ steps.build-components.outputs.docx_link }})
211+ - :eyes: Quick [preview of course website here](${{ steps.build-components.outputs.bookdown_link }}) \*
212+ - :microscope: Comprehensive [download of the course website here](${{ steps.build-components.outputs.zip_link }})
213+ - Download the [.docx file](${{ steps.build-components.outputs.docx_link }})
204214
205- _Updated at ${{ steps.build-components.outputs.time }} with changes from ${{ steps.build-components.outputs.commit_id }}_
215+ \* note not all html features will be properly displayed in the "quick preview" but it will give you a rough idea.
216+
217+ _Updated at ${{ steps.build-components.outputs.time }} with changes from the latest commit ${{ steps.build-components.outputs.commit_id }}_
206218 edit-mode : replace
207219
208220 - name : Comment if no changes
0 commit comments