Skip to content

Commit

Permalink
Fix documentation workflow always trying to commit
Browse files Browse the repository at this point in the history
Don't try to commit and push if there is nothing to commit, because git will exit with 1, failing the workflow.
  • Loading branch information
penev92 authored and abcdefg30 committed Nov 29, 2023
1 parent 855568c commit ca6b87d
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 }}
)

0 comments on commit ca6b87d

Please sign in to comment.