Last active
January 4, 2023 22:26
-
-
Save amacneil/f14db753919e0af2d7d2f5a8da7fce65 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/bin/bash | |
# if we are testing a PR, merge it with the latest master branch before testing | |
# this ensures that all tests pass with the latest changes in master. | |
set -eu -o pipefail | |
PR_NUMBER=${CI_PULL_REQUEST//*pull\//} | |
err=0 | |
if [ -z "$PR_NUMBER" ]; then | |
exit | |
fi | |
(set -x && git pull --ff-only origin "refs/pull/$PR_NUMBER/merge") || err=$? | |
if [ "$err" -ne "0" ]; then | |
echo | |
echo -e "\033[0;31mERROR: Failed to merge your branch with the latest master." | |
echo -e "Please manually merge master into your branch, and push the changes to GitHub.\033[0m" | |
exit $err | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment