Update merge-upstream-pull-request.sh

This commit is contained in:
LetterJay
2017-09-05 17:00:16 -05:00
committed by GitHub
parent 06437a49e6
commit ef79e47884
+16 -1
View File
@@ -1,4 +1,11 @@
#!/usr/bin/env bash
source ~/.discordauth
# ~/.discordauth contains:
# CHANNELID=x
# TOKEN=x
# CHANNELID being the Discord Channel ID
# TOKEN being the bot token
set -u # don't expand unbound variable
set -f # disable pathname expansion
@@ -37,6 +44,14 @@ if ! git remote | grep tgstation > /dev/null; then
git remote add tgstation https://github.com/tgstation/tgstation.git
fi
curl -v \
-H "Authorization: Bot $TOKEN" \
-H "User-Agent: myBotThing (http://some.url, v0.1)" \
-H "Content-Type: application/json" \
-X POST \
-d "{\"content\":\"Mirroring [$1] from /tg/ to Hippie\"}" \
https://discordapp.com/api/channels/$CHANNELID/messages
# We need to make sure we are always on a clean master when creating the new branch.
# So we forcefully reset, clean and then checkout the master branch
git fetch --all
@@ -62,7 +77,7 @@ echo "$CHERRY_PICK_OUTPUT"
# If it's a squash commit, you can't use -m 1, you need to remove it
# You also can't use -m 1 if it's a rebase and merge...
if echo "$CHERRY_PICK_OUTPUT" | grep 'error: mainline was specified but commit'; then
if echo "$CHERRY_PICK_OUTPUT" | grep -i 'error: mainline was specified but commit'; then
echo "Commit was a squash, retrying"
if containsElement "$MERGE_SHA" "${COMMITS[@]}"; then
for commit in $COMMITS; do