This is an automated email from the ASF dual-hosted git repository. tobous pushed a commit to branch exit-cleanly-if-nothing-to-deploy in repository https://gitbox.apache.org/repos/asf/db-jdo-site.git
commit f5d09d8be2adb4d899973dc7883cb742f809cdf1 Author: Tobias Bouschen <tobias.bousc...@googlemail.com> AuthorDate: Tue Feb 9 15:05:48 2021 +0100 Only try to publish results if there are any changes Adjusts the deploy action to only try to commit and push if there are any staged changes. This avoids the action "failing" if there is nothing to commit. --- .github/workflows/deploy-site.yml | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/.github/workflows/deploy-site.yml b/.github/workflows/deploy-site.yml index 2f17dc4..fb0e7a9 100644 --- a/.github/workflows/deploy-site.yml +++ b/.github/workflows/deploy-site.yml @@ -124,15 +124,30 @@ jobs: rmdir -v -p target/site - # Publishes the build results - # Does nothing if there is nothing to publish - - name: Publish Results + - name: Stage Changes + id: stage-changes if: success() run: | - echo "Staging new content" git add -v -A - echo + if $(git diff -s --cached --exit-code) + then + # nothing staged + echo "Nothing to commit" + has_staged_changes=false + else + # something staged + has_staged_changes=true + fi + + echo "::set-output name=HAS_STAGED_CHANGES::$has_staged_changes" + + + # Publishes the build results + # Does nothing if there is nothing to publish + - name: Publish Results + if: success() && steps.stage-changes.outputs.HAS_STAGED_CHANGES == 'true' + run: | echo "Committing changes" git commit -m "Auto-deploy site for commit ${{ steps.short-sha.outputs.SHORT_SHA }}" echo