From eae1cf2f704effb78cccf9a293f99d326d38ff54 Mon Sep 17 00:00:00 2001 From: Carles Pina i Estany Date: Thu, 5 Nov 2020 08:28:13 +0000 Subject: [PATCH] Avoid failing if no changes are to be pushed --- entrypoint.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index bbb679e..b673545 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -43,7 +43,9 @@ COMMIT_MESSAGE="${COMMIT_MESSAGE/ORIGIN_COMMIT/$ORIGIN_COMMIT}" git add . git status -git commit --message "$COMMIT_MESSAGE" + +# git diff-index : to avoid doing the git commit failing if there are no changes to be commit +git diff-index --quiet HEAD || git commit --message "$COMMIT_MESSAGE" echo "Pushing git commit" git push origin "$TARGET_BRANCH"