From 9925f84b58bbacb4c080ca58408435afb967ea69 Mon Sep 17 00:00:00 2001 From: andy Augustin Date: Tue, 3 Jan 2023 12:34:08 +0100 Subject: [PATCH] fix(): #285 fix empty commit exit with error :bug: (#286) --- src/sync_template.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/sync_template.sh b/src/sync_template.sh index 68f6294..b1bae12 100644 --- a/src/sync_template.sh +++ b/src/sync_template.sh @@ -76,7 +76,7 @@ fi if [ -s "${TEMPLATE_SYNC_IGNORE_FILE_PATH}" ]; then echo "::group::restore ignore file" - info "restore the ignore file" + info "restore the ignore file" git reset "${TEMPLATE_SYNC_IGNORE_FILE_PATH}" git checkout -- "${TEMPLATE_SYNC_IGNORE_FILE_PATH}" echo "::endgroup::" @@ -98,6 +98,11 @@ if [ -s "${TEMPLATE_SYNC_IGNORE_FILE_PATH}" ]; then git checkout -- . fi +if git diff --quiet && git diff --staged --quiet; then + info "nothing to commit" + exit 0 +fi + git commit -m "${PR_COMMIT_MSG}" echo "::endgroup::"