Skip to content

Commit c06d2df

Browse files
committed
Modify "changes is ready!" to "there is no change!" when appropriate
1 parent f4adc25 commit c06d2df

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

.github/workflows/doc-build.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,8 @@ jobs:
170170
# Restore the new doc dropping changes by "wipe out"
171171
(cd doc && git checkout --quiet -f HEAD~1)
172172
.github/workflows/create-changes-html.sh diff.txt doc
173+
du -b diff.txt | cut -f1 > doc/DIFF_FILE_SIZE.txt
174+
# note that the file above is generated after generating the diff, be careful to not contaminate the git diff
173175
# Sometimes rm -rf .git errors out because of some diehard hidden files
174176
# So we simply move it out of the doc directory
175177
(cd doc && mv .git ../git && mv .gitattributes ../gitattributes)

.github/workflows/doc-publish.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ permissions:
2727
jobs:
2828
publish-doc:
2929
runs-on: ubuntu-latest
30+
needs: doc-html
3031
if: github.event.workflow_run.conclusion == 'success'
3132
env:
3233
CAN_DEPLOY: ${{ secrets.NETLIFY_AUTH_TOKEN != '' && secrets.NETLIFY_SITE_ID != '' }}
@@ -52,6 +53,17 @@ jobs:
5253
- name: Extract doc
5354
run: unzip doc.zip -d doc
5455
if: steps.download-doc.outcome == 'success'
56+
# WARNING: the folder structure is doc/doc/<files>, so for example the CHANGES.html
57+
# generated by doc-build.yml is at doc/doc/CHANGES.html
58+
59+
- name: Read diff file size
60+
id: read-diff-file-size
61+
continue-on-error: true
62+
run: |
63+
cat doc/doc/DIFF_FILE_SIZE.txt # debug print
64+
{ printf 'result='; cat doc/doc/DIFF_FILE_SIZE.txt; } >> "$GITHUB_OUTPUT"
65+
# note that the result will have type string! although "== 0" coerce to number, see
66+
# https://docs.github.com/en/actions/reference/workflows-and-actions/expressions
5567

5668
- name: Deploy to Netlify
5769
id: deploy-netlify
@@ -75,7 +87,7 @@ jobs:
7587
header: preview-comment
7688
recreate: false
7789
message: |
78-
[Documentation preview for this PR](${{ steps.deploy-netlify.outputs.NETLIFY_URL }}/html/en) (built with commit ${{ steps.source-run-info.outputs.sourceHeadSha }}; [changes](${{ steps.deploy-netlify.outputs.NETLIFY_URL }}/CHANGES.html)) is ready! :tada:
90+
[Documentation preview for this PR](${{ steps.deploy-netlify.outputs.NETLIFY_URL }}/html/en) (built with commit ${{ steps.source-run-info.outputs.sourceHeadSha }}; ${{ steps.read-diff-file-size.outputs.result != 0 && format('[changes]({0}/CHANGES.html) ({1} bytes) is ready!', steps.deploy-netlify.outputs.NETLIFY_URL, steps.read-diff-file-size.outputs.result) || 'there is no change! ' }} :tada:
7991
This preview will update shortly after each push to this PR.
8092
if: steps.download-doc.outcome == 'success'
8193

0 commit comments

Comments
 (0)