diff --git a/.githooks/commit-msg/skip.sh b/.githooks/commit-msg/skip.sh new file mode 100644 index 000000000..76d952d53 --- /dev/null +++ b/.githooks/commit-msg/skip.sh @@ -0,0 +1,54 @@ +#!/bin/bash + +# Copyright (c) 2016-2017 Martin Donath + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. + +# Exit, if there's no .travisignore file +if [[ ! -a .travisignore ]]; then + exit +fi + +# Filter relevant files for linting +FILES=$(git diff --cached --name-only) + +# Load the patterns we want to skip into an array +mapfile -t BLACKLIST < .travisignore + +# Remove the pattern from the list of changes +for $pattern in "${BLACKLIST[@]}"; do + CHANGES=( ${CHANGES[@]/$pattern/} ) + + # If we've exhausted the list of changes before we've finished going + # through patterns, that's okay, just quit the loop + if [[ ${#CHANGES[@]} -eq 0 ]]; then + break + fi +done + +# If there's changes left, then we have stuff to build, leave the commit alone +if [[ ${#CHANGES[@]} -gt 0 ]]; then + exit +fi + +# Prefix the commit message with "[skip ci]" +sed -i '1s/$/ [skip ci]/' "$1" + +# We're good +exit 0 diff --git a/.githooks/post-merge/npm-update.sh b/.githooks/post-merge/install.sh similarity index 100% rename from .githooks/post-merge/npm-update.sh rename to .githooks/post-merge/install.sh diff --git a/.travisignore b/.travisignore new file mode 100644 index 000000000..747ccf96d --- /dev/null +++ b/.travisignore @@ -0,0 +1,5 @@ +.github/* +docs/* +material/* +CHANGELOG +*.md