diff --git a/smart-commit/Dockerfile b/smart-commit/Dockerfile new file mode 100644 index 0000000..c3be59c --- /dev/null +++ b/smart-commit/Dockerfile @@ -0,0 +1,4 @@ +FROM alpine/git + +COPY ./smart-commit /bin/smart-commit +ENTRYPOINT ["sh /bin/smart-commit"] diff --git a/smart-commit/smart-commit b/smart-commit/smart-commit new file mode 100755 index 0000000..45adb08 --- /dev/null +++ b/smart-commit/smart-commit @@ -0,0 +1,10 @@ +#! /bin/bash + +STATUS=$(git status --porcelain) +STATUS_LEN=${#STATUS} +if [ $STATUS_LEN = 0 ]; then + exit 0 +else + git add . + git commit -qm "CI/CD Commit: $(date -Iseconds)" +fi diff --git a/smart-commit/smart-commit.sh b/smart-commit/smart-commit.sh old mode 100755 new mode 100644 index 45adb08..e724356 --- a/smart-commit/smart-commit.sh +++ b/smart-commit/smart-commit.sh @@ -1,4 +1,4 @@ -#! /bin/bash +#! /bin/sh STATUS=$(git status --porcelain) STATUS_LEN=${#STATUS}