forked from pencil2d/pencil
-
Notifications
You must be signed in to change notification settings - Fork 1
/
checkchanges.sh
44 lines (35 loc) · 872 Bytes
/
checkchanges.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
set -e
if [[ $branch == "release" ]]; then
exit 0
fi
commit=$TRAVIS_COMMIT
branch=$TRAVIS_BRANCH
commit_range=$TRAVIS_COMMIT_RANGE
echo "branch is: $branch"
printf "git diff --name-only %s\n" "${commit_range}"
CHANGED_FILES=`git diff --name-only ${commit_range}`
printf "%s\n" "${CHANGED_FILES}"
printf "=============\n"
ONLY_READMES=True
MD=".md"
SH=".sh"
PY=".py"
PS1=".ps1"
for CHANGED_FILE in $CHANGED_FILES; do
#printf "Check ${CHANGED_FILES}\n"
if ! [[ $CHANGED_FILE =~ $MD ||
$CHANGED_FILE =~ $SH ||
$CHANGED_FILE =~ $PY ||
$CHANGED_FILE =~ $PS1 ]] ; then
ONLY_READMES=False
printf "Gotcha! %s\n" "${CHANGED_FILE}"
break
fi
done
if [[ $ONLY_READMES == True ]]; then
echo "Only non source code files found, exiting."
exit 1
else
echo "source code changes found, continuing with build."
fi