Fix documentation workflow always trying to commit

Don't try to commit and push if there is nothing to commit, because git will exit with 1, failing the workflow.
This commit is contained in:
Pavel Penev
2023-11-28 10:28:25 +02:00
committed by abcdefg30
parent 855568cab7
commit ca6b87d05e

View File

@@ -87,9 +87,12 @@ jobs:
cd wiki
git config --local user.email "actions@github.com"
git config --local user.name "GitHub Actions"
git add --all
git commit -m "Update auto-generated documentation for ${{ needs.prepare.outputs.git_tag }}"
git push origin master
git diff-index --quiet HEAD || \
(
git add --all && \
git commit -m "Update auto-generated documentation for ${{ needs.prepare.outputs.git_tag }}" && \
git push origin master
)
docs:
name: Update docs.openra.net
@@ -137,6 +140,9 @@ jobs:
cd docs
git config --local user.email "actions@github.com"
git config --local user.name "GitHub Actions"
git add api/*.md
git commit -m "Update auto-generated documentation for ${{ needs.prepare.outputs.git_tag }}"
git push origin ${{ needs.prepare.outputs.version_type }}
git diff-index --quiet HEAD || \
(
git add api/*.md && \
git commit -m "Update auto-generated documentation for ${{ needs.prepare.outputs.git_tag }}" && \
git push origin ${{ needs.prepare.outputs.version_type }}
)