Skip to content

Instantly share code, notes, and snippets.

@wakaba
Last active December 29, 2017 04:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wakaba/ab553f86cd017e0cb28c6dbb5364b009 to your computer and use it in GitHub Desktop.
Save wakaba/ab553f86cd017e0cb28c6dbb5364b009 to your computer and use it in GitHub Desktop.
#!/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 "merger@travis.test"
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.
@wakaba
Copy link
Author

wakaba commented Dec 29, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment