Start writing the script for merging a gitea PR
This commit is contained in:
parent
3c4061b37e
commit
3127fa2e4c
|
@ -0,0 +1,43 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
REPOAPIURL=https://git.bitmessage.org/api/v1/repos/Bitmessage/PyBitmessage
|
||||||
|
upstream="v0.6"
|
||||||
|
|
||||||
|
if [ -z "${1}" ]; then
|
||||||
|
echo "Please specify a credential string"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "${2}" ]; then
|
||||||
|
echo "No PR# specified, here is a list:"
|
||||||
|
curl -s --request GET -u ${1} ${REPOAPIURL}/pulls \
|
||||||
|
| jq '.[] | .number, .title' | paste - -
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
pr=$(curl -s --request GET -u ${1} ${REPOAPIURL}/pulls/${2})
|
||||||
|
|
||||||
|
branch=$(echo $pr | jq '.head | (.repo.clone_url + " " + .label)' | tr -d '"')
|
||||||
|
title=$(echo $pr | jq '.title')
|
||||||
|
body=$(echo $pr | jq '.body')
|
||||||
|
|
||||||
|
|
||||||
|
echo "Merging PR ${2}"
|
||||||
|
|
||||||
|
git checkout -b gitea-${2} v0.6
|
||||||
|
git pull ${branch}
|
||||||
|
git push --set-upstream origin gitea-${2}
|
||||||
|
|
||||||
|
if [ -z "${3}" ]; then
|
||||||
|
echo "No github credentials specified, stopping"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
head=$(echo ${3} | cut -d: -f1):gitea-${2}
|
||||||
|
|
||||||
|
# echo "-d {\"title\":${title},\"body\":${body},\"head\":\"${head}\",\"base\":\"${upstream}\"}"
|
||||||
|
|
||||||
|
curl -u ${3} -X POST \
|
||||||
|
-H "Accept: application/vnd.github.v3+json" \
|
||||||
|
https://api.github.com/repos/Bitmessage/PyBitmessage/pulls \
|
||||||
|
-d "{\"title\":${title},\"body\":${body},\"head\":\"${head}\",\"base\":\"${upstream}\"}"
|
Loading…
Reference in New Issue