From 85980ee060a1e26cc436b1381a404131f9e76d82 Mon Sep 17 00:00:00 2001 From: Nick Dumas Date: Fri, 3 Feb 2023 17:50:35 +0000 Subject: [PATCH] new container image --- smart-commit/Dockerfile | 4 ++++ smart-commit/smart-commit | 10 ++++++++++ smart-commit/smart-commit.sh | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 smart-commit/Dockerfile create mode 100755 smart-commit/smart-commit mode change 100755 => 100644 smart-commit/smart-commit.sh 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}