Browse Source

Script checking presence of unignored paths.

Herby Vojčík 4 years ago
parent
commit
906af5f735
3 changed files with 40 additions and 0 deletions
  1. 1 0
      .gitignore
  2. 15 0
      check-some-are-unignored.sh
  3. 24 0
      package.json

+ 1 - 0
.gitignore

@@ -0,0 +1 @@
+/node_modules/

+ 15 - 0
check-some-are-unignored.sh

@@ -0,0 +1,15 @@
+#!/bin/sh
+set -e -x
+
+if [ -n "$PLUGIN_IGNORE" -a \( -n "$PLUGIN_POSITIVE" -o -n "$PLUGIN_NEGATIVE" \) ]; then
+  set "$PLUGIN_IGNORE" "$PLUGIN_POSITIVE" "$PLUGIN_NEGATIVE"
+fi
+
+PATHS="`IFS='
+' paste -s -d:`"
+
+if [ -z "$PATHS" ] || [ -z "`node --eval "console.log(require('ignore')().add(process.argv[1].split(',')).filter(process.argv[2].split(':')).join())" "$1" "$PATHS"`" ]; then
+  if [ -n "$3" ]; then touch "$3"; fi
+else
+  if [ -n "$2" ]; then touch "$2"; fi
+fi

+ 24 - 0
package.json

@@ -0,0 +1,24 @@
+{
+  "name": "drone-plugin-check-changes",
+  "version": "0.1.0",
+  "description": "Checks if there are changes in repo at specific files / dirs",
+  "scripts": {
+    "test": "echo \"Error: no test specified\" && exit 1"
+  },
+  "repository": {
+    "type": "git",
+    "url": "https://lolg.it/herby/drone-plugin-check-changes.git"
+  },
+  "keywords": [
+    "drone",
+    "plugin",
+    "monorepo",
+    "check",
+    "changes"
+  ],
+  "author": "Herby Vojčík <herby@mailbox.sk>",
+  "license": "MIT",
+  "dependencies": {
+    "ignore": "^5.1.4"
+  }
+}