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,15 +32,17 @@ jobs:
3132 # Make the branch fresh
3233 - name : Make the branch fresh
3334 run : |
34- git config --local user.email "itcrtrainingnetwork@gmail.com"
35- git config --local 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'
3638
3739 branch_name='preview-${{ github.event.pull_request.number }}'
3840 echo branch doesnt exist
3941 git checkout -b $branch_name || echo branch exists
40- git push --set-upstream origin $branch_name
42+ git push --set-upstream origin $branch_name || echo echo branch exists remotely
4143 shell : bash
4244
45+
4346 outputs :
4447 toggle_spell_check : " ${{ env.SPELL_CHECK }}"
4548 toggle_style_code : " ${{ env.STYLE_CODE }}"
5861 check_type : spelling
5962 error_min : 3
6063 gh_pat : secrets.GH_PAT
64+ branch_name : ${GITHUB_HEAD_REF}
6165
6266 url-check :
6367 name : Check URLs
6872 check_type : urls
6973 error_min : 0
7074 gh_pat : secrets.GH_PAT
75+ branch_name : ${GITHUB_HEAD_REF}
7176
7277 quiz-check :
7378 name : Check quiz formatting
7883 check_type : quiz_format
7984 error_min : 0
8085 gh_pat : secrets.GH_PAT
86+ branch_name : ${GITHUB_HEAD_REF}
8187
8288# ############################ Style the code ###################################
8389 style-code :
9096
9197 steps :
9298 - name : Checkout files
93- uses : actions/checkout@v3
99+ uses : actions/checkout@v4
94100 with :
95101 fetch-depth : 0
96102
@@ -116,16 +122,16 @@ jobs:
116122
117123 steps :
118124 - name : Checkout files
119- uses : actions/checkout@v3
125+ uses : actions/checkout@v4
120126 with :
121127 fetch-depth : 0
122128
123129 # Set up git checkout
124130 - name : Set up git checkout
125131 run : |
126- git config --system --add safe.directory " $GITHUB_WORKSPACE"
127- git config --local user.email "itcrtrainingnetwork@gmail.com"
128- 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'
129135
130136 branch_name='preview-${{ github.event.pull_request.number }}'
131137 git fetch --all
@@ -154,6 +160,9 @@ jobs:
154160 echo Toc-less status ${{steps.tocless.outcome}}
155161 exit 1
156162
163+ - name : Website preview for download
164+ run : zip website-preview.zip docs/* -r
165+
157166 # Commit the rendered bookdown files
158167 - name : Commit rendered bookdown files to preview branch
159168 id : commit
@@ -163,7 +172,7 @@ jobs:
163172 echo "changes=$changes" >> $GITHUB_OUTPUT
164173 git add . --force
165174 git commit -m 'Render preview' || echo "No changes to commit"
166- 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
167176 git push --force || echo "No changes to commit"
168177 shell : bash
169178
@@ -182,6 +191,8 @@ jobs:
182191 bookdown_link=$(echo "https://htmlpreview.github.io/?https://raw.githubusercontent.com/$GITHUB_REPOSITORY/preview-${{ github.event.pull_request.number }}/docs/index.html")
183192 tocless_link=$(echo "https://htmlpreview.github.io/?https://raw.githubusercontent.com/$GITHUB_REPOSITORY/preview-${{ github.event.pull_request.number }}/docs/no_toc/index.html")
184193 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
185196 echo "bookdown_link=$bookdown_link" >> $GITHUB_OUTPUT
186197 echo "tocless_link=$tocless_link" >> $GITHUB_OUTPUT
187198 echo "docx_link=$docx_link" >> $GITHUB_OUTPUT
@@ -197,11 +208,13 @@ jobs:
197208 issue-number : ${{ github.event.pull_request.number }}
198209 body : |
199210 Re-rendered previews from the latest commit:
200- - See [preview of Bookdown here](${{ steps.build-components.outputs.bookdown_link }})
201- - See [preview of Coursera/Leanpub version here](${{ steps.build-components.outputs.tocless_link }})
202- - 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 }})
203214
204- _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 }}_
205218 edit-mode : replace
206219
207220 - name : Comment if no changes
0 commit comments