File tree Expand file tree Collapse file tree 2 files changed +19
-8
lines changed Expand file tree Collapse file tree 2 files changed +19
-8
lines changed Original file line number Diff line number Diff line change @@ -101,21 +101,26 @@ esac
101101git log --oneline --decorate --all --graph | head -n 10;
102102echo " Check changes for: ${COMMIT_RANGE} "
103103
104- # `grep` uses return value to report both result and error.
105- # So `set -e` should be disabled to catch them.
106- set +e
107- git diff --name-only " ${COMMIT_RANGE} " | grep -qvE " $1 "
108- case $? in
109- 0)
104+ FILE_CHANGES=$( git diff --name-only " ${COMMIT_RANGE} " )
105+ RESULT=$?
106+ if [[ " $RESULT " -ne 0 ]]
107+ then
108+ echo " Error: cannot get changed files"
109+ exit $RESULT
110+ fi
111+
112+ grep -qvE " $1 " <<< " $FILE_CHANGES" && RESULT=0 || RESULT=$?
113+ case $RESULT in
114+ 0)
110115 noskip_travis
111116 ;;
1121171)
113118 echo " Only '$1 ' were updated, or there's no change, not running the CI."
114119 skip_travis
115120 ;;
116- * )
121+ * )
117122 echo " Error in grep pattern"
118- exit -1
123+ exit $RESULT
119124 ;;
120125esac
121126
Original file line number Diff line number Diff line change 3737
3838MERGIFY_COMMITTER=" mergify[bot] <mergify[bot]@users.noreply.github.com>"
3939COMMITTER=$( git show --format=" %cN <%cE>" --no-patch " ${TRAVIS_COMMIT} " )
40+ RESULT=$?
41+ if [[ " $RESULT " -ne 0 ]]
42+ then
43+ echo " Error: cannot get the committer"
44+ exit $RESULT
45+ fi
4046
4147if [[ " ${COMMITTER} " = " ${MERGIFY_COMMITTER} " ]]
4248then
You can’t perform that action at this time.
0 commit comments