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