mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2025-02-25 21:58:40 +01:00
Added githook to skip CI build on non-src changes
This commit is contained in:
parent
41ed99c3d3
commit
17f67ae625
@ -28,27 +28,27 @@ fi
|
|||||||
# Filter relevant files for linting
|
# Filter relevant files for linting
|
||||||
FILES=$(git diff --cached --name-only)
|
FILES=$(git diff --cached --name-only)
|
||||||
|
|
||||||
# Load the patterns we want to skip into an array
|
# Resolve the patterns we want to skip
|
||||||
mapfile -t BLACKLIST < .travisignore
|
BLACKLIST=$(< .travisignore)
|
||||||
|
|
||||||
# Remove the pattern from the list of changes
|
# Remove the pattern from the list of changes
|
||||||
for $pattern in "${BLACKLIST[@]}"; do
|
for f in $BLACKLIST; do
|
||||||
CHANGES=( ${CHANGES[@]/$pattern/} )
|
FILES=( ${FILES[@]/$f/} )
|
||||||
|
|
||||||
# If we've exhausted the list of changes before we've finished going
|
# If we've exhausted the list of changes before we've finished going
|
||||||
# through patterns, that's okay, just quit the loop
|
# through patterns, that's okay, just quit the loop
|
||||||
if [[ ${#CHANGES[@]} -eq 0 ]]; then
|
if [[ ${#FILES[@]} -eq 0 ]]; then
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# If there's changes left, then we have stuff to build, leave the commit alone
|
# If there's changes left, then we have stuff to build, leave the commit alone
|
||||||
if [[ ${#CHANGES[@]} -gt 0 ]]; then
|
if [[ ${#FILES[@]} -gt 0 ]]; then
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Prefix the commit message with "[skip ci]"
|
# Prefix the commit message with "[skip ci]"
|
||||||
sed -i '1s/$/ [skip ci]/' "$1"
|
sed -i '' '1s/$/ [skip ci]/' "$1"
|
||||||
|
|
||||||
# We're good
|
# We're good
|
||||||
exit 0
|
exit 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user