Fix errors:

- propose only open PRs from gitea
  - use ssh_url - both repos should have ssh urls
  - exit if pull failed
This commit is contained in:
Lee Miller 2022-05-19 02:19:12 +03:00
parent 3127fa2e4c
commit 8e1666b05a
Signed by untrusted user: lee.miller
GPG Key ID: 4F97A5EA88F4AB63
1 changed files with 3 additions and 3 deletions

View File

@ -11,13 +11,13 @@ 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 - -
| jq '.[] | select(.state == "open") | .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 '"')
branch=$(echo $pr | jq '.head | (.repo.ssh_url + " " + .label)' | tr -d '"')
title=$(echo $pr | jq '.title')
body=$(echo $pr | jq '.body')
@ -25,7 +25,7 @@ body=$(echo $pr | jq '.body')
echo "Merging PR ${2}"
git checkout -b gitea-${2} v0.6
git pull ${branch}
git pull ${branch} || exit 1
git push --set-upstream origin gitea-${2}
if [ -z "${3}" ]; then