From efa1aacd1ba5d1fba34df9abd0e083289f803df8 Mon Sep 17 00:00:00 2001 From: Jonathan Wren Date: Sat, 8 Feb 2020 17:33:47 -0800 Subject: [PATCH] Stop multipe changelog generators from crashing into each other --- .build/generate_changelog.sh | 9 +++++++++ 1 file changed, 9 insertions(+) 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