+# Check for git repo changes within the last $MAX_GIT_REPO_AGE_HOURS hours
+#
+# It makes sense to set the value twice the 'cron' interval for the job (e.g.
+# if 'cron: @daily', then MAX_GIT_REPO_AGE_HOURS=48)
+
+if ! [[ "${MAX_GIT_REPO_AGE_HOURS:=0}" =~ ^[0-9]+$ ]]; then
+ echo '[ERROR] MAX_GIT_REPO_AGE_HOURS must be non-negative integer.' \
+ >&2
+ exit 1
+fi
+
+if [ ${MAX_GIT_REPO_AGE_HOURS:=0} -ne 0 ]; then
+ LAST_COMMIT_AGE=$(( $(date +%s) - $(git log -1 --pretty=format:%ct) ))
+
+ if [ $LAST_COMMIT_AGE -gt $(( MAX_GIT_REPO_AGE_HOURS *60*60 )) ]; then
+ echo '[NOTICE] Git repository did not have any commits last' \
+ "${MAX_GIT_REPO_AGE_HOURS} hours - no need to re-analyse it." \
+ >&2
+ exit 0
+ fi
+fi
+
+#-----------------------------------------------------------------------------
+# Process parameters for JS/TS/Python/Ruby/PHP files analysis