Skip to content

Commit f274dd9

Browse files
committed
Don't fail doc CI if nothing changed
1 parent 142e68a commit f274dd9

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

.github/workflows/doc.yml

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ env:
2525

2626

2727
# In the very unlikely cases where two PRs are merged, and the first 'doc' job is still running when the 2nd 'full-ci' starts,
28-
# make sure the first one is awaited. Even though docs are eventually overwritten, this ensures continuitiy in the doc repo history.
28+
# make sure the first one is awaited. Even though docs are eventually overwritten, this ensures continuity in the doc repo history.
2929
concurrency:
3030
group: 'sync-doc'
3131
cancel-in-progress: false
@@ -58,6 +58,7 @@ jobs:
5858
# For email address, see https://github.community/t/github-actions-bot-email-address/17204
5959
# As search-index.js changes every time, even if source hasn't changed, this will not need 'git commit --allow-empty'
6060
- name: "Prepare upload"
61+
id: prepareUpload
6162
run: |
6263
mkdir ~/.ssh
6364
echo '${{ secrets.DOC_DEPLOY_SSH_KEY }}' > ~/.ssh/id_rsa
@@ -72,25 +73,32 @@ jobs:
7273
mv ${GITHUB_WORKSPACE}/target/doc/* .
7374
mv ${GITHUB_WORKSPACE}/.github/workflows/doc/* .
7475
75-
GDRUST_VERSION=$(grep -Po '^version = "\K[^"]*' ${GITHUB_WORKSPACE}/gdnative/Cargo.toml)
76-
GDRUST_SHORT_SHA=$(git rev-parse --short "${GITHUB_SHA}")
76+
libVersion=$(grep -Po '^version = "\K[^"]*' ${GITHUB_WORKSPACE}/gdnative/Cargo.toml)
77+
shortSha=$(git rev-parse --short "${GITHUB_SHA}")
7778
78-
find gdnative -name .html -o -type f -print0 | xargs -0 sed -i 's/'"${GDRUST_VERSION}"'/master/g'
79+
find gdnative -name .html -o -type f -print0 | xargs -0 sed -i 's/'"$libVersion"'/master/g'
7980
80-
git add --all
81-
git commit -m "Sync doc from ${GDRUST_SHORT_SHA}
82-
83-
Revision in godot-rust: ${GITHUB_SHA}"
81+
if git diff --exit-code
82+
then
83+
echo "$shortSha introduces no doc changes; skip commit and push."
84+
else
85+
git add --all
86+
git commit -m "Sync doc from $shortSha
87+
88+
Revision in godot-rust: ${GITHUB_SHA}"
89+
90+
echo ::set-output name=docsChanged::true
91+
fi
8492

8593
- name: "Upload"
8694
working-directory: doc
8795
run: git push origin ${GDRUST_DOC_BRANCH}
96+
if: ${{ steps.prepareUpload.outputs.docsChanged == 'true' }}
8897

8998
- name: "Cleanup"
9099
run: shred -u ~/.ssh/id_rsa
91100

92101

93-
94102
# Possible alternative: dispatching a remote workflow
95103

96104
# - name: 'Dispatch remote workflow'

0 commit comments

Comments
 (0)