From 8cedf16622ae0d2a49102c29f2ef52af9451f856 Mon Sep 17 00:00:00 2001 From: Joseph Petersen Date: Wed, 16 Feb 2022 07:48:00 +0100 Subject: [PATCH] only commit if there are changes --- .github/workflows/action-build.yml | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/workflows/action-build.yml b/.github/workflows/action-build.yml index 28b366714..15d59bd2d 100644 --- a/.github/workflows/action-build.yml +++ b/.github/workflows/action-build.yml @@ -36,9 +36,14 @@ jobs: - run: yarn build - name: Commit and push if needed - uses: stefanzweifel/git-auto-commit-action@v4 - with: - commit_message: Apply dist/index.js changes - commit_user_name: 'github-actions[bot]' - commit_user_email: 'github-actions[bot]@users.noreply.github.com' - commit_author: 'github-actions[bot] ' + run: | + git add . + if [ -z "$(git status --porcelain)" ]; then + echo "💾 no changes to dist/index.js" + exit 0 + fi + git config --local user.email "github-actions[bot]@users.noreply.github.com" + git config --local user.name "github-actions[bot]" + git commit -m "Apply dist/index.js changes" + git push + echo "💾 pushed dist/index.js changes"