Created
June 2, 2015 15:13
-
-
Save MatthewRDodds/3ad29d0dd67a77d66810 to your computer and use it in GitHub Desktop.
Travis Changelog Update Check
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# This script is run as part of the travis CI process to ensure that the | |
# changelog in every app has been updated when working on a feature branch. | |
# If there is no update to the changelog file (CHANGELOG.md), it exits with | |
# an error causing the travis build to fail. | |
# Only run this when ci script is executed by travis | |
${CI?"Not excuted by travis"} | |
found=false | |
main_branches=(master qa production) | |
case "${main_branches[@]}" in *"$TRAVIS_BRANCH"*) found=true ;; esac | |
app_name=$(basename `pwd`) | |
organization='your-org' | |
changelog_file='CHANGELOG.md' | |
if $found | |
then | |
echo "Not on a feature branch" | |
else | |
cd ../ | |
repo="git@github.com:$organization/$app_name.git" | |
git clone --depth=50 $repo ${app_name}_dup | |
diff=$(git diff --name-only $app_name ${app_name}_dup) | |
if [[ $diff == *"$changelog_file"* ]] | |
then | |
echo "Changelog Updated"; | |
else | |
echo "Failed to update changelog"; | |
exit 1 | |
fi | |
cd $app_name | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment