14
14
runs-on : ubuntu-latest
15
15
steps :
16
16
- name : Checkout
17
- uses : actions/checkout@v3
17
+ uses : actions/checkout@v4
18
18
with :
19
19
fetch-depth : 0
20
+ token : ${{ secrets.GH_PAT }}
20
21
21
22
# Use the yaml-env-action action.
22
23
- name : Load environment from YAML
@@ -31,16 +32,17 @@ jobs:
31
32
# Make the branch fresh
32
33
- name : Make the branch fresh
33
34
run : |
34
- git config --global --add safe.directory ${ GITHUB_WORKSPACE}
35
- git config --global user.email "[email protected] "
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'
37
38
38
39
branch_name='preview-${{ github.event.pull_request.number }}'
39
40
echo branch doesnt exist
40
41
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
42
43
shell : bash
43
44
45
+
44
46
outputs :
45
47
toggle_spell_check : " ${{ env.SPELL_CHECK }}"
46
48
toggle_style_code : " ${{ env.STYLE_CODE }}"
59
61
check_type : spelling
60
62
error_min : 3
61
63
gh_pat : secrets.GH_PAT
64
+ branch_name : ${GITHUB_HEAD_REF}
62
65
63
66
url-check :
64
67
name : Check URLs
69
72
check_type : urls
70
73
error_min : 0
71
74
gh_pat : secrets.GH_PAT
75
+ branch_name : ${GITHUB_HEAD_REF}
72
76
73
77
quiz-check :
74
78
name : Check quiz formatting
79
83
check_type : quiz_format
80
84
error_min : 0
81
85
gh_pat : secrets.GH_PAT
86
+ branch_name : ${GITHUB_HEAD_REF}
82
87
83
88
# ############################ Style the code ###################################
84
89
style-code :
91
96
92
97
steps :
93
98
- name : Checkout files
94
- uses : actions/checkout@v3
99
+ uses : actions/checkout@v4
95
100
with :
96
101
fetch-depth : 0
97
102
@@ -117,16 +122,16 @@ jobs:
117
122
118
123
steps :
119
124
- name : Checkout files
120
- uses : actions/checkout@v3
125
+ uses : actions/checkout@v4
121
126
with :
122
127
fetch-depth : 0
123
128
124
129
# Set up git checkout
125
130
- name : Set up git checkout
126
131
run : |
127
- git config --system --add safe.directory " $GITHUB_WORKSPACE"
128
- git config --local user.email "[email protected] "
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'
130
135
131
136
branch_name='preview-${{ github.event.pull_request.number }}'
132
137
git fetch --all
@@ -155,6 +160,9 @@ jobs:
155
160
echo Toc-less status ${{steps.tocless.outcome}}
156
161
exit 1
157
162
163
+ - name : Website preview for download
164
+ run : zip website-preview.zip docs/* -r
165
+
158
166
# Commit the rendered bookdown files
159
167
- name : Commit rendered bookdown files to preview branch
160
168
id : commit
@@ -164,7 +172,7 @@ jobs:
164
172
echo "changes=$changes" >> $GITHUB_OUTPUT
165
173
git add . --force
166
174
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
168
176
git push --force || echo "No changes to commit"
169
177
shell : bash
170
178
@@ -183,6 +191,8 @@ jobs:
183
191
bookdown_link=$(echo "https://htmlpreview.github.io/?https://raw.githubusercontent.com/$GITHUB_REPOSITORY/preview-${{ github.event.pull_request.number }}/docs/index.html")
184
192
tocless_link=$(echo "https://htmlpreview.github.io/?https://raw.githubusercontent.com/$GITHUB_REPOSITORY/preview-${{ github.event.pull_request.number }}/docs/no_toc/index.html")
185
193
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
186
196
echo "bookdown_link=$bookdown_link" >> $GITHUB_OUTPUT
187
197
echo "tocless_link=$tocless_link" >> $GITHUB_OUTPUT
188
198
echo "docx_link=$docx_link" >> $GITHUB_OUTPUT
@@ -198,11 +208,13 @@ jobs:
198
208
issue-number : ${{ github.event.pull_request.number }}
199
209
body : |
200
210
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 }})
204
214
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 }}_
206
218
edit-mode : replace
207
219
208
220
- name : Comment if no changes
0 commit comments