ci: skip containerized-tests for doc-only PRs

Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
Niels de Vos
2020-08-12 12:08:40 +02:00
committed by mergify[bot]
parent 648c3f7f77
commit 693d7b953e
2 changed files with 67 additions and 4 deletions

38
scripts/skip-doc-change.sh Executable file
View File

@ -0,0 +1,38 @@
#!/bin/bash -e
#
GIT_SINCE="${1}"
if [ -z "${GIT_SINCE}" ]; then
GIT_SINCE='origin/master'
fi
CHANGED_FILES=$(git diff --name-only "${GIT_SINCE}")
[[ -z $CHANGED_FILES ]] && exit 1
skip=0
#files to be skipped
declare -a FILES=(^docs/ .md$ ^scripts/ LICENSE .mergify.yml .github .gitignore)
function check_file_present() {
local file=$1
for FILE in "${FILES[@]}"; do
if [[ $file =~ $FILE ]]; then
if [[ $file =~ (minikube.sh|travis-functest.sh) ]]; then
continue
fi
return 0
fi
done
return 1
}
for CHANGED_FILE in $CHANGED_FILES; do
if ! check_file_present "$CHANGED_FILE"; then
skip=1
fi
done
if [ $skip -eq 0 ]; then
echo "doc change only"
exit 1
fi