-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpushbranch.sh
executable file
·30 lines (28 loc) · 990 Bytes
/
pushbranch.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/sh
# make a new branch and push to your remote
set -e
pkg=$1
newbranch=$2
commitmsg=$3
cd $pkg
oldbranch=$(git rev-parse --abbrev-ref HEAD)
git checkout -b $newbranch
git add .
git commit -m "$commitmsg"
git remote add mine-oauth https://$(cat ../../token):x-oauth-basic@github.com/$USER/$pkg.jl
git push mine-oauth +$newbranch
git remote rm mine-oauth
#owner=$(basename $(dirname $(cat ../METADATA/$pkg/url)))
#curl -s -H "Authorization: token $(cat ../../token)" \
# -d "{\"title\": \"$(echo $commitmsg | head -n1)\", \
# \"body\": \"$(echo $commitmsg | tail -n+2)\", \
# \"head\": \"$USER:$newbranch\", \
# \"base\": \"$oldbranch\", \
# \"maintainer_can_modify\": true}" \
# https://api.github.com/repos/$owner/$pkg.jl/pulls | jq . #> /dev/null
# TODO: check if the response says invalid, fail loudly if that happens
#sleep 3 # avoid making the rate limit too mad
git checkout $oldbranch
#git show $newbranch | git apply
git branch -D $newbranch
cd ..