Browse Source

Drone bug(s) workaround.

Herby Vojčík 4 years ago
parent
commit
5cabe64c2b
1 changed files with 8 additions and 0 deletions
  1. 8 0
      check-vcs-changes.sh

+ 8 - 0
check-vcs-changes.sh

@@ -1,6 +1,14 @@
 #!/bin/sh
 set -e -x
 
+#Workaround, drone doesn't give a fuck to set DRONE_COMMIT_BEFORE
+if [ -n "$DRONE_COMMIT_AFTER" -a -n "$DRONE_COMMIT_LINK" -a -z "$DRONE_COMMIT_BEFORE" ]; then
+  export DRONE_COMMIT_BEFORE=`echo "$DRONE_COMMIT_LINK" | sed \
+    -e '/[0-9a-fA-F]\{7,\}[.]\{2,\}'"$DRONE_COMMIT_AFTER"'$/ !d' \
+    -e 's/^.*\<\([0-9a-fA-F]\{7,\}\)[.]\{2,\}'"$DRONE_COMMIT_AFTER"'$/\1/'`
+fi
+#end of workaround
+
 if [ -n "$PLUGIN_IGNORE" -a \( -n "$PLUGIN_POSITIVE" -o -n "$PLUGIN_NEGATIVE" \) ]; then
   set "$PLUGIN_IGNORE" "$PLUGIN_POSITIVE" "$PLUGIN_NEGATIVE"
 fi