|
@@ -13,13 +13,34 @@ |
|
|
branch=$(git symbolic-ref HEAD | sed 's/^refs\/heads\///')
|
|
|
[ -z "$branch" ] && {
|
|
|
echo "could not determine current branch" 1>&2
|
|
|
- false
|
|
|
+ exit 2
|
|
|
}
|
|
|
|
|
|
-echo "This will turn issue $2 on $1 into a pull request for branch '$branch'"
|
|
|
-read -s -p "GitHub Password: " pwd
|
|
|
+# WIP
|
|
|
+if ! [ -e ~/.githubauthorization ]
|
|
|
+then
|
|
|
+ read -p "GitHub username: " name
|
|
|
+ read -s -p "GitHub password: " pass
|
|
|
+
|
|
|
+ curl -u "$name:$pass" https://api.github.com/authorizations -s \
|
|
|
+ -d '{"note":"for scripts", "scopes":["repo", "user", "public_repo", "gists"]}' \
|
|
|
+ | grep -Po '"token":.*?[^\\]",' | sed 's/\"token\": \"//g' | sed 's/\",//g' \
|
|
|
+ > ~/.githubauthorization
|
|
|
+
|
|
|
+ echo "Generated and saved an oauth token here ~/.githubauthorization"
|
|
|
+fi
|
|
|
+
|
|
|
+token=`cat ~/.githubauthorization`
|
|
|
+echo "Turning issue $2 on $1 into a pull request for branch '$branch'"
|
|
|
+
|
|
|
+curl -H "Authorization: token $token" https://api.github.com/repos/$1/pulls \
|
|
|
+ -d '{"issue":'$2', "head":"'$branch'", "base":"master"}' \
|
|
|
+ | grep -Po '"url":.*?[^\\]",' | sed 's/\"url\": \"//g' | sed 's/\",//g'
|
|
|
|
|
|
-curl -u "tclem:$pwd" https://api.github.com/repos/$1/pulls \
|
|
|
- -d '{"issue":'$2', "head":"'$branch'", "base":"master"}'
|
|
|
+# Old Direct method
|
|
|
+# read -s -p "GitHub Password: " pwd
|
|
|
|
|
|
-echo
|
|
|
+# curl -u "tclem:$pwd" https://api.github.com/repos/$1/pulls \
|
|
|
+# -d '{"issue":'$2', "head":"'$branch'", "base":"master"}'
|
|
|
+#
|
|
|
+# echo
|
0 comments on commit
5be7010