projects
/
maintainer-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
github-merge-pr: add option to use SSH key for github auth
[maintainer-tools.git]
/
github-merge-pr.sh
diff --git
a/github-merge-pr.sh
b/github-merge-pr.sh
index 863d3b753aa0d5bd0c15156ba4e8171f7b320143..b30b519193870a68290d9a7637e77513e9b8e35b 100755
(executable)
--- a/
github-merge-pr.sh
+++ b/
github-merge-pr.sh
@@
-9,6
+9,9
@@
REPO="openwrt/openwrt"
# - Enter a description, e.g. "pr.sh" and pick the "repo" scope
# - Hit "Generate token"
#TOKEN="d41d8cd98f00b204e9800998ecf8427e"
# - 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}"
PRID="$1"
BRANCH="${2:-master}"
@@
-75,7
+78,11
@@
fi
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_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"
if ! $GIT remote get-url $PR_USER &> /dev/null || [ -n "$DRY_RUN" ]; then
echo "Adding $PR_USER with repo $PR_REPO to remote"