Last active
December 29, 2017 04:05
-
-
Save wakaba/ab553f86cd017e0cb28c6dbb5364b009 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
#!/usr/bin/perl | |
open $file, '>', '.travis-merge'; | |
print $file q{#!/bin/sh | |
if [ "$TRAVIS_BRANCH" = "staging" ] || [ "$TRAVIS_BRANCH" = "nightly" ] || [ "$TRAVIS_BRANCH" = "nightlywp" ]; then | |
echo "Merge $TRAVIS_BRANCH ($TRAVIS_COMMIT) into master..." | |
git config --global user.email "[email protected]" | |
git config --global user.name "Travis Merger" | |
git config --global url.https://$TRAVISMERGER_GH_TOKEN:@github.com/.pushInsteadOf https://github.com/ | |
if [ -s "$(git rev-parse --git-dir)/shallow" ]; then | |
git fetch --unshallow origin master && git checkout FETCH_HEAD | |
else | |
git fetch origin master && git checkout FETCH_HEAD | |
fi | |
git merge $TRAVIS_COMMIT && \ | |
((git push -q origin HEAD:master 2> /dev/null && curl -f https://$TRAVISMERGER_BWALL_TOKEN:@bwall1$TRAVISMERGER_BWALL_APP.herokuapp.com/ping/merger.$TRAVIS_BRANCH/`perl -e '$x=$ENV{TRAVIS_REPO_SLUG};$x=~s{([^A-Za-z0-9])}{sprintf "%%%02X", ord $1}ge;print $x'` -X POST) || (echo "push failed" && false)) | |
fi | |
}; | |
close $file; | |
exec 'sh', '.travis-merge'; | |
## License: Public Domain. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Previous version: https://gist.github.com/wakaba/9970857