From b422effcfa5b1b6519bc65f2cb2b6f36c48a5e58 Mon Sep 17 00:00:00 2001 From: Tim Carry Date: Mon, 8 Oct 2018 13:06:06 +0200 Subject: [PATCH] Skip linting the docs when making a change to the root (#484) It seems that Netlify is having some caching of the git remote and while this PR was working fine when I submitted it, it now fails as it has forgotten which remote to use. I'm going to go and accept it, in order to group all the code that deals with Netlify in the same branch, allowing me to better have them work together. --- docs/package.json | 2 +- docs/scripts/prepush | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100755 docs/scripts/prepush diff --git a/docs/package.json b/docs/package.json index bb40007a..89e417c5 100644 --- a/docs/package.json +++ b/docs/package.json @@ -9,7 +9,7 @@ "lint:css": "./scripts/lint-css", "lint:md": "./scripts/lint-md", "lint:md:fix": "./scripts/lint-md-fix", - "prepush": "yarn lint", + "prepush": "./scripts/prepush", "serve": "babel-node ./scripts/serve.js" }, "devDependencies": { diff --git a/docs/scripts/prepush b/docs/scripts/prepush new file mode 100755 index 00000000..6c81734d --- /dev/null +++ b/docs/scripts/prepush @@ -0,0 +1,13 @@ +#!/usr/bin/env sh + +git diff --name-status master | grep 'docs/' 1>/dev/null +DOCS_FOLDER_HAS_CHANGED=$? + +# We don't run the docs linting if no changes were made in the docs +if [ "$DOCS_FOLDER_HAS_CHANGED" = "1" ]; then + exit 0 +fi + +yarn run lint:js && \ +yarn run lint:css && \ +yarn run lint:md