# - Enter a description, e.g. "pr.sh" and pick the "repo" scope
# - Hit "Generate token"
#TOKEN="d41d8cd98f00b204e9800998ecf8427e"
+#
+# Uncomment this line to use SSH key to rebase PR branch
+# USE_SSH=1
PRID="$1"
BRANCH="${2:-master}"
PR_USER="$(echo "$PR_INFO" | jq -r ".head.user.login")"
PR_BRANCH="$(echo "$PR_INFO" | jq -r ".head.ref")"
LOCAL_PR_BRANCH="$PR_BRANCH"-"$PR_USER"
-PR_REPO="$(echo "$PR_INFO" | jq -r ".head.repo.html_url")"
+if [ "$USE_SSH" = "1" ]; then
+ PR_REPO="$(echo "$PR_INFO" | jq -r ".head.repo.ssh_url")"
+else
+ PR_REPO="$(echo "$PR_INFO" | jq -r ".head.repo.html_url")"
+fi
if ! $GIT remote get-url $PR_USER &> /dev/null || [ -n "$DRY_RUN" ]; then
echo "Adding $PR_USER with repo $PR_REPO to remote"