BayernMessenger/tools/travis/check_pr.sh

46 lines
1.2 KiB
Bash
Raw Normal View History

2019-03-13 16:00:30 +00:00
#!/usr/bin/env bash
#
# Copyright 2018 New Vector Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
branch=${TRAVIS_BRANCH}
# echo ${TRAVIS_BRANCH}
# If not on develop, exit, else we cannot get the list of modified files
# It is ok to check only when on develop branch
if [[ "${branch}" -eq 'develop' ]]; then
2019-03-13 16:50:03 +00:00
echo "Check that the file 'CHANGES.md' has been modified"
2019-03-13 16:00:30 +00:00
else
echo "Not on develop branch"
exit 0
fi
# git status
listOfModifiedFiles=`git diff --name-only HEAD ${branch}`
# echo "List of modified files by this PR:"
# echo ${listOfModifiedFiles}
2019-03-13 16:50:03 +00:00
if [[ ${listOfModifiedFiles} = *"CHANGES.md"* ]]; then
echo "CHANGES.md has been modified!"
2019-03-13 16:00:30 +00:00
else
2019-03-13 16:50:03 +00:00
echo "❌ Please add a line describing your change in CHANGES.md"
2019-03-13 16:00:30 +00:00
exit 1
fi