From ef79e478845a45701357fe42cc300802e4622d11 Mon Sep 17 00:00:00 2001 From: LetterJay Date: Tue, 5 Sep 2017 17:00:16 -0500 Subject: [PATCH] Update merge-upstream-pull-request.sh --- citadel/tools/merge-upstream-pull-request.sh | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/citadel/tools/merge-upstream-pull-request.sh b/citadel/tools/merge-upstream-pull-request.sh index 69ee3e91c6..3c140dd56c 100755 --- a/citadel/tools/merge-upstream-pull-request.sh +++ b/citadel/tools/merge-upstream-pull-request.sh @@ -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