Add script to merge master into the current branch if required before running specs

This commit is contained in:
Rohan Mitchell
2015-05-06 19:41:36 +10:00
parent d109e898d2
commit 6d33dc5070
2 changed files with 19 additions and 0 deletions

View File

@@ -12,6 +12,13 @@ function exit_unless_master_merged {
fi
}
function succeed_if_master_merged {
if [[ `git branch -a --merged origin/$BUILDKITE_BRANCH` == *origin/master* ]]; then
echo "This branch already has the current master merged."
exit 0
fi
}
function drop_and_recreate_database {
# Adapted from: http://stackoverflow.com/questions/12924466/capistrano-with-postgresql-error-database-is-being-accessed-by-other-users
psql -U openfoodweb postgres <<EOF

View File

@@ -0,0 +1,12 @@
#!/bin/bash
set -e
source ./script/ci/includes.sh
succeed_if_master_merged
git checkout $BUILDKITE_BRANCH
git merge origin/$BUILDKITE_BRANCH
git merge origin/master -m "Auto-merge from CI [skip ci]"
git push origin $BUILDKITE_BRANCH
git checkout origin/$BUILDKITE_BRANCH