diff --git a/.build/generate_changelog.sh b/.build/generate_changelog.sh index 58867c20c..943bf786d 100755 --- a/.build/generate_changelog.sh +++ b/.build/generate_changelog.sh @@ -48,6 +48,15 @@ fi git config --global user.email "jrnl.bot@gmail.com" git config --global user.name "Jrnl Bot" git checkout $BRANCH +git pull origin $BRANCH + +# Check if branch has been updated since this build started +# This tends to happen if multiple things have been merged in at the same time. +if [[ $(git rev-parse head) != $TRAVIS_COMMIT ]]; then + echo "${BRANCH} has been updated since build started. Aborting changelog." + exit 0 +fi + git add "$FILENAME" git commit -m "Updating changelog [ci skip]" git push https://${GITHUB_TOKEN}@github.com/jrnl-org/jrnl.git $BRANCH