From 98e87b06ad0d0b35fc933675a02ac4f745c6b5c3 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Thu, 18 Aug 2022 20:32:01 -0600 Subject: [PATCH] Only commit website changes if there are some --- .github/workflows/deploy.yml | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 62920ce2ac..beda21734c 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -32,11 +32,13 @@ jobs: - run: | cp -r build/site/* openlayers.github.io/dist/ cd openlayers.github.io - git config user.name "$(git --no-pager log --format=format:'%an' -n 1)" - git config user.email "$(git --no-pager log --format=format:'%ae' -n 1)" - git add . - git commit -m "Website updates" - git push origin main + if [ -n "$(git status --porcelain)" ]; then + git config user.name "$(git --no-pager log --format=format:'%an' -n 1)" + git config user.email "$(git --no-pager log --format=format:'%ae' -n 1)" + git add . + git commit -m "Website updates" + git push origin main + fi deploy-tag: if: startsWith(github.ref, 'refs/tags/') runs-on: ubuntu-latest @@ -60,8 +62,10 @@ jobs: - run: | cp -r build/site/* openlayers.github.io/dist/ cd openlayers.github.io - git config user.name "$(git --no-pager log --format=format:'%an' -n 1)" - git config user.email "$(git --no-pager log --format=format:'%ae' -n 1)" - git add . - git commit -m "Website updates" - git push origin main + if [ -n "$(git status --porcelain)" ]; then + git config user.name "$(git --no-pager log --format=format:'%an' -n 1)" + git config user.email "$(git --no-pager log --format=format:'%ae' -n 1)" + git add . + git commit -m "Website updates" + git push origin main + fi