From 224d68233d1d53c0a123b64bd4cefb0fe13311e5 Mon Sep 17 00:00:00 2001 From: akloeckner Date: Mon, 10 May 2021 09:33:11 +0000 Subject: [PATCH] Add check for changes in master branch --- check-master-for-changes.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 check-master-for-changes.sh diff --git a/check-master-for-changes.sh b/check-master-for-changes.sh new file mode 100644 index 0000000..8f3c77d --- /dev/null +++ b/check-master-for-changes.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +commitdate=$(curl -sL "https://api.github.com/repos/resoai/TileBoard/commits/master" | jq -r ".commit.author.date") +commitdays=$(( ( $(date --utc +%s) - $(date --utc -d $commitdate +%s) ) / 86400 )) +echo "Last commit was $commitdays days ago." + +if [ $commitdays -lt 2 ] ; then + echo "There ARE recent changes in the repository." +else + echo "There are NO recent changes in the repository." + echo "Aborting pipeline." + exit 78 # drone.io exit code to stop but success the pipeline +fi \ No newline at end of file