Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
3ec1698830 | ||
![]() |
395826abb6 |
53
pr.sh
Normal file
53
pr.sh
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
|
||||||
|
git config --global alias.visual '!gitk'
|
||||||
|
|
||||||
|
# check dirty
|
||||||
|
if [ -n "$(git status --porcelain)" ]; then
|
||||||
|
git status
|
||||||
|
echo "there are untracked changes";
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# TODO: check up-to-date
|
||||||
|
local_head_commit=`git rev-parse --short HEAD`
|
||||||
|
remote_head_commit=`git rev-parse --short origin/HEAD`
|
||||||
|
|
||||||
|
local_branch=`git rev-parse --abbrev-ref HEAD`
|
||||||
|
remote_branch=${local_head_commit}
|
||||||
|
|
||||||
|
echo ${local_head_commit}
|
||||||
|
echo ${remote_head_commit}
|
||||||
|
echo ${local_branch}
|
||||||
|
echo ${remote_branch}
|
||||||
|
|
||||||
|
# TODO: keep first branch
|
||||||
|
git push origin master ${local_branch}:${remote_branch}
|
||||||
|
|
||||||
|
|
||||||
|
git config --get remote.origin.url
|
||||||
|
|
||||||
|
access_token=`git config user.accessToken`
|
||||||
|
# TODO: check empty
|
||||||
|
|
||||||
|
# TODO: create or update
|
||||||
|
curl -X 'POST' \
|
||||||
|
'https://code.newnius.com/api/v1/repos/snippets/Tampermonkey/pulls?access_token='${access_token} \
|
||||||
|
-H 'accept: application/json' \
|
||||||
|
-H 'Content-Type: application/json' \
|
||||||
|
-d '{
|
||||||
|
"assignee": "newnius",
|
||||||
|
"assignees": [
|
||||||
|
"newnius"
|
||||||
|
],
|
||||||
|
"base": "master",
|
||||||
|
"body": "diff",
|
||||||
|
"due_date": "2022-01-15T08:31:16.272Z",
|
||||||
|
"head": "${remote_branch}",
|
||||||
|
"labels": [
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"milestone": 0,
|
||||||
|
"title": "string"
|
||||||
|
}'
|
Loading…
Reference in New Issue
Block a user