From f31b125868382169009d89318389acd5944b615c Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Thu, 29 Dec 2016 17:09:23 -0800 Subject: [PATCH] [Emacs] Only attempt an update if the build is based on master --- gen-gh-pages/deploy.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/gen-gh-pages/deploy.sh b/gen-gh-pages/deploy.sh index 4548ec2e..6d45c3a8 100755 --- a/gen-gh-pages/deploy.sh +++ b/gen-gh-pages/deploy.sh @@ -5,8 +5,8 @@ THIS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" cd $THIS_DIR -git config user.name "$COMMIT_AUTHOR_NAME" -git config user.email "$COMMIT_AUTHOR_EMAIL" +git config --global user.name "$COMMIT_AUTHOR_NAME" +git config --global user.email "$COMMIT_AUTHOR_EMAIL" set -e # Exit with nonzero exit code if anything fails @@ -59,4 +59,11 @@ mv ../README.html ./index.html git add --all . git commit -m "Deploy to GitHub Pages: ${SHA}" -git push "$SSH_REPO" "$TARGET_BRANCH" +git fetch origin master + +if [ "$(git rev-parse origin/master)" == "$SHA" ]; then + git push "$SSH_REPO" "$TARGET_BRANCH" + +else + echo "The commit this build was started for is not the one on master. Doing nothing." +fi